|
Take a look at this[^], and see if you can work out how to apply it to a PictureBox.
BTW, unless you absolutely have to, avoid PictureBox. It is only good for displaying a picture that you will never, and I mean never, interact with.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi ,
PictureBox1.Handle is how you get the handel (hdc)
you will require to change the declaration a bit , the new declaration of the API
should be as following
Public Declare Function ExtFloodFill Lib "gdi32" Alias "ExtFloodFill"
(ByVal hdc As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal
crColor As Integer, ByVal wFillType As Integer) As Integer
Hope this helps
Let me know if you need further help
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Hi,
I think I got this ASP.NET Server Control code from here. It works in Firefox but not in IE. Does anyone know why?
ASP.net 2.0
Language - VB
Site Content Manager – Dot Net Nuke
VB Code:
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.ComponentModel
Imports System.Collections
Public Class MapControl
Inherits WebControl
#Region "Variables"
Private _dataSource As IEnumerable
Private _VarMap As String = "var map = null;"
Private _GetMapOpen As String = "function GetMap(){"
Private _CloseBracket As String = "}"
Private _LoadMap As String = "map.LoadMap();"
Private _PinId1 As String = "var pinid1=0;"
Private _Locs1Array As String = "var locs1 = new Array;"
Private _MapAddPushpin As String = "map.AddPushpin(pin);"
Private _IncrementPinId As String = "pinid1++;"
Private _Latitude As String = "47.6"
Private _Longitude As String = "-122.33"
Private _ZoomLevel As Integer = 10
#End Region
#Region "Properties"
Public Property DataSource() As IEnumerable
Get
Return _dataSource
End Get
Set(ByVal value As IEnumerable)
_dataSource = value
End Set
End Property
<Browsable(True), Category("Position")> _
Public Property Latitude() As String
Get
Return _Latitude
End Get
Set(ByVal value As String)
_Latitude = value
End Set
End Property
<Browsable(True), Category("Position")> _
Public Property Longitude() As String
Get
Return _Longitude
End Get
Set(ByVal value As String)
_Longitude = value
End Set
End Property
<Browsable(True), Category("Position")> _
Public Property ZoomLevel() As Integer
Get
Return _ZoomLevel
End Get
Set(ByVal value As Integer)
_ZoomLevel = value
End Set
End Property
#End Region
#Region "String Functions"
Private Function NewNamedMap(ByVal MapName As String) As String
Return "map = new VEMap('" & MapName & "');"
End Function
Private Function NewLocation(ByVal longatude As String, ByVal latitude As String) As String
Return "var loc = new VELatLong(" & longatude & "," & latitude & ");"
End Function
Private Function AddPushPin(ByVal Arr As String, ByVal Location As String) As String
Return Arr & ".push(" & Location & ");"
End Function
Private Function ForOpen(ByVal Arr As String) As String
Return "for (i=0; i < " & Arr & ".length; i++){"
End Function
Private Function RunBestMap(ByVal Arr As String) As String
Return "DoBestMap(" & Arr & ");"
End Function
#End Region
#Region "Map Strings"
Private Function MapWithDatasource() As String
Dim str As String = ""
str &= "<script "
str &= "type=""text/javascript"""
str &= ">"
str &= _GetMapOpen & _VarMap & NewNamedMap("MyNewMap") & _LoadMap
str &= _Locs1Array
str &= _PinId1
Dim DataEnum As IEnumerator
DataEnum = DataSource.GetEnumerator()
Dim i As Integer = 0
'str &= ForOpen("locs1")
While (DataEnum.MoveNext())
Dim st1, st2, st3, st4 As String
st1 = DataEnum.Current
DataEnum.MoveNext()
st2 = DataEnum.Current
DataEnum.MoveNext()
st3 = DataEnum.Current
DataEnum.MoveNext()
st4 = DataEnum.Current
str &= NewLocation(st1, st2)
str &= AddPushPin("locs1", "loc")
str &= "var pin = new VEPushpin(" & i.ToString & ", locs1[" & i.ToString & "], null, '" & st3 & "', '" & st4 & "');"
str &= "map.AddPushpin(pin);"
i += 1
End While
'str &= _CloseBracket
str &= "map.SetMapView(locs1);"
str &= _CloseBracket
str &= "</script>"
Return str
End Function
Private Function BasicMap() As String
Dim str As String = ""
str = "<script ""language=""JavaScript"">"
If Latitude <> "" And Longitude <> "" Then
str &= _GetMapOpen & _VarMap & NewNamedMap("MyNewMap") & _
"map.LoadMap(new VELatLong(" & Latitude.ToString & "," & Longitude.ToString & "), " & ZoomLevel.ToString & ",'h' ,false);" & _CloseBracket
Else
str &= _GetMapOpen & _VarMap & NewNamedMap("MyNewMap") & _LoadMap & _CloseBracket
End If
str &= "</script>"
Return str
End Function
#End Region
#Region "Control Methods"
Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
MyBase.OnPreRender(e)
Dim meta As String = "<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"">"
Dim link As String = "<script type=""text/javascript"" src=""http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2""></script>"
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "Meta", meta)
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "Link", link)
Controls.Add(New LiteralControl("<div id='MyNewMap' style=""position:relative; width:600px; height:300px;""></div>"))
If Not _dataSource Is Nothing Then
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "OnLoad", MapWithDatasource)
Else
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "OnLoad", BasicMap)
End If
End Sub
Protected Overrides Sub OnDataBinding(ByVal e As EventArgs)
Controls.Clear()
End Sub
#End Region
End Class
|
|
|
|
|
Probably do better in the ASP forum.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi,
i am using multiple tables to create a report since Microsoft report viewer does not allow multiple tables so i have used a stored procedure with parameter. i have refreshed my data set and now my dataset also contains the data table for the stored procedure.the .rdlc also has been successfully linked with the columns and rows of the stored procedure data table. in the form where i am using the report viewer in the load event i have used the table adapter for the stored procedure to fill the stored procedure data table with the values, i am also passing the parameter to the table adapter.
but on doing this i get an error:
Error 1 Value of type 'innoerp.innoerpDataSet1.StoredProcedure2DataTable' cannot be converted to 'innoerp.innoerpDataSet.StoredProcedure2DataTable'. C:\Documents and Settings\prog- 2\My Documents\Visual Studio 2008\Projects\innoerp1\innoerp1\Daily Sales Report.vb 11 47 innoerp1
here innoerp is the name of my database and storedprocedure2 is the storedprocedure
please help!!!!!!!!!!
thanks in advance
|
|
|
|
|
sourav_bhargava wrote: StoredProcedure2DataTable
I have no idea what the method does for you but your problem has NOTHING to do with the report viewer. You probably have a line of code like:
StoredProcedure2DataTable = getTableFromXXXXXXX
Change it to
StoredProcedure2DataTable = (StoredProcedure2DataTable)getTableFromXXXXXXX
I beleive you need to box the second half!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
thanks Mycroft Holmes for the reply.
i think you are right, but i actually am not being able to figure this one out.
here is the code i have used in form load
Imports Microsoft.Reporting.WinForms.ReportDataSource
Public Class DailySalesReport
Private Sub Daily_Sales_Report_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dt As New DataTable
'TODO: This line of code loads data into the 'innoerpDataSet.salesmen' table. You can move, or remove it, as needed.
Me.SalesmenTableAdapter.Fill(Me.innoerpDataSet.salesmen)
Me.ReportViewer1.LocalReport.DataSources.Clear()
Me.StoredProcedure2TableAdapter1.Fill(InnoerpDataSet1.StoredProcedure2, ComboBox1.Text)
Me.ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("dt", dt))
Me.ReportViewer1.RefreshReport()
End Sub
End Class
this is giving the error i have earlier mentioned.
|
|
|
|
|
Going to be difficult, I never work with the tableadapters, horrible things they are. What type does Me.StoredProcedure2TableAdapter1.Fill expect as it's forst parameter. Presumably salesman fills Ok so what are the differences between the 2 methods!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
fill wants data table of as the first parameter
|
|
|
|
|
thank you every one the problem has been resolved .
i just created another dataset specially to keep the data table values and then filled the table adapter and then refreshed the report viewer this solved the problem.
|
|
|
|
|
hello every one
i want to add columns in checklisbiox like listview so that i can make the width of column to zero which will be not visible to end user is there any code in .net which is helpful to me. in vb i had used checklistbox for the same and it worked but in .net the same is not working.
please suggest what to do..
thank u in advance..
|
|
|
|
|
I'm using instructions from Bob Powell's website [^] to save an edited image back to its original file name. Here's my problem:
This is a batch operation with multiple images receiving the same changes. Often, I'll get the GDI+ generic error caused when the original image in memory has not been disposed. The new image to be written back to the original is created one line before disposing of the original (locked) bitmap:
newImg = CreateNewImage(tmpBMP, newW, newH) 'created in function elsewhere in app
tmpBMP.Dispose()
'Following the above code is the code that sets the format and saves the image
The error does not occur if I do the following instead:
newImg = CreateNewImage(tmpBMP, newW, newH)
tmpBMP.Dispose()
If tmpBMP.Equals(Nothing) Then
MsgBox("NOTHING")
End If
'Following the above code is the code that sets the format and saves the image
The graphics object used to draw the new image in memory is disposed in the called function.
Am I correct in assuming that my app isn't getting enough time to dispose of the original before trying to write back to it? The msgbox NEVER actually opens either way, which also confuses me (I'm a newbie to GDI+).
If I do need to be sure the app has enough time to dispose of the original, what is a good way to create the necessary delay? Any suggestions appreciated.
AB
|
|
|
|
|
Dispose() does not set the object to Nothing, you need to do that yourself. I am guessing the extra code creates time for something to happen in the framework. Ultimately, you're struggling against a bug in .NET, I believe if you change the way you load your image, you can get around this.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Christian Graus wrote: I am guessing the extra code creates time for something to happen in the framework
Thanks Christian.
I moved the dispose() statement to the function that creates the new image. That seems to have solved the problem. If worse come to worse, I can probably drop a timer into the code somewhere.
|
|
|
|
|
Hey,
I am trying to print an overview with a For Each loop. Now, in this loop I check whether the current Y position exceeds the pages maximum Y, and if so, I set e.HasMorePages to True . However, this isn't working. It keeps printing and printing while it shouldn't. Here is an example of my code. (In the PrintDocument.PrintPage Event)
For Each Uitgave As Xml.XmlNode In UitgavenNode.ChildNodes(MonthToPrint).ChildNodes
...
StartY+=PrintFont.GetHeight
If StartY >= e.MarginBounds.Height Then
StartY = e.MarginBounds.Y
e.HasMorePages = True
Else
e.HasMorePages = False
End If
Next
So the bottom line is: When StartY >= e.MarginBounds.Height then it must jump to a blank page and continue printing. Please note that this all happens within a loop and printing must continue at the same position within the loop.
Please tell me what's wrong with this code, so I can fix it
Thanks in advance,
Zaegra
Motivation is the key to software development.
|
|
|
|
|
The PrintPage event is fired for each and every page that gets printed. Your code sample is a bit incomplete, but it looks like you're printing the same thing on every page. Are you printing only what fits on a page, saying the point in the loop that you're at and restarting the loop at the point you saved in the previous handling of the PrintPage event.
|
|
|
|
|
Hi there, I'm trying to migrate an existing vb6 mail application to vb 2008 but it fails conversion. Anyway I'm looking for a module to send email with attachments using outlook 2003. Code must be written in vb 2008. What I can't get is attaching a document to the email! What I have so far is:
Module Module1
Dim app As Object
Dim itm As Object
Dim myItem As Object
Dim myAttachments As Object
Sub sendmail()
app = CreateObject("Outlook.Application")
itm = app.CreateItem(0)
With itm
.To = "someone@yahoo.com"
.CC = "someone@hotmail.com"
.Subject = "test"
'.importance = "high"
'.BodyFormat = Microsoft.Office.Interop.OutlookolFormatHTML
.Body = "Test message"
.send()
End With
MsgBox("message sent", vbOKOnly, "sent....")
End Sub
End Module
All I do is call the sendmail() function from a cmd button! There are other example send mail applications out there but they are written in vb.net and uses smtp(which I don't need)
|
|
|
|
|
I'm pretty sure that itm should have an attachment property.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I hope it did, but vb2008 is different from vb6 (which had the attachment property).
|
|
|
|
|
It doesn't matter. The object you're using are not exposed by VB6 or VB.NET. They are exposed by the COM-based classes you are creating instances of. The properties would be identical.
|
|
|
|
|
I use this
Dim oMail As System.Net.Mail.MailMessage
Dim oFrom As System.Net.Mail.MailAddress
Dim oSmtp As System.Net.Mail.SmtpClient
oMail = New System.Net.Mail.MailMessage
oFrom = New System.Net.Mail.MailAddress("me@here.com")
oSmtp = New System.Net.Mail.SmtpClient("mail.here.com")
oMail.From = oFrom
oMail.To.Add("him@here.com, him@there.com, another@there.com)
oMail.Subject = "My Subject"
oMail.Priority = Net.Mail.MailPriority.Normal
oMail.IsBodyHtml = True
oMail.Body = "Body of rmail here"
oSmtp.Send(oMail)
|
|
|
|
|
Does this piece of code require you to setup an smtp server in IIS? If it does, then this piece of code will not work in my case. All I want to do is send an email with an attachment via outlook 2003 (connects to microsoft exchange) and the code needs to be compatible with vb2008.
My first post has working code (in vb2008) that can send email with outlook 2003, BUT without attachments!
|
|
|
|
|
I guess all you need to add is this line
<br />
.Attachments.Add("c:\myfolder\myfile.txt")
But this gives me security warning.
I will try to find how to avoid it.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
I have now switch to office 2007 and adding these lines worked perfectly:
' Add an attachment
Dim sSource As String = "C:\somefile.extension"
Dim sBodyLen As String = oMsg.Body.Length
Dim sDisplayName As String = ""
Dim oAttachs As Outlook.Attachments = oMsg.Attachments
Dim oAttach As Outlook.Attachment
oAttach = oAttachs.Add(sSource, , , sDisplayName)
oMsg.Send()
|
|
|
|
|
how to create round shapes??
could this work-
in a label(backcolor set equal to form's) set a round image.
won't this increase the cpu time??
i am looking for an efficient way to create a round shape
like in vb6 we'd just chose the shape control.
but in vb2008 all controls that don't have handles are dropped
is there a way to do so??
eh?
TheMrProgrammer
|
|
|
|