|
Yeah, I am binding to a column called "CoverSample" in a DataView object.
Let's say the CoverSample contains an empty path, then the 'e' value will be "" (means empty).
There are no error occurs, but when it reach the
"picBook.DataBindings.Add(b)", error will occurs, and the error won't be caught even if i have try to catch the error. How?
The following code should have no comments, the previous code i post, the code was commented out.
Dim b As Binding = New Binding("Image", objDView, "CoverSample")
AddHandler b.Format, AddressOf MyPictureBox_FormatImage
picBook.DataBindings.Add(b)
Learning .NET
|
|
|
|
|
What's the exact error? I can't reproduce the problem. Copy and paste it into here...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
This is the error:
An unhandled exception of type 'System.InvalidCastException' occured in mscorlib.dll
Addtional information: Inavalid cast from System.String to String.Drawing.Image
This error occur on the following code:
Dim oFrmBookDetails = New frmBookDetails()
oFrmBookDetails.MdiParent = Me
oFrmBookDetails.Show() 'This is where the error occur. 'I know it from highlighted code when the error occurs.
Try
Dim b As Binding = New Binding("Image", objDView, "CoverSample")
AddHandler b.Format, AddressOf MyPictureBox_FormatImage
picBook.DataBindings.Add(b)
Catch ex As InvalidCastException
MsgBox(ex.Message, , "BindFields")
End Try
Every time i set the breakpoint, if i press F8, it will step into "Dim b As Binding...", then "AddHandler..." without going to "Adrressof MyPictureBox_FormatImage", after that "picBook.DataBindings.Add(b)", then step into "oFrmBookDetails.Show()". When showing, it execute the "MyPictureBox_FormatImage" procedure.
I think it should be execute the "MyPictureBox_FormatImage" first, then step into "oFrmBookDetails.Show()". How come it step into "oFrmBookDetails.Show()" first, then going into "MyPictureBox_FormatImage" procedure.
Learning .NET
|
|
|
|
|
Now we know where the error is actually occuring. You might want to wrap the .Show() line inside it's own Try/Catch block. I don't know if your going to get the results you expect or not. Also, is it possible that something else on the form is throwing the InvalidCastException ?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Sorry, cause of the language barrier between us, i don't get ur mean. I already put the .Show() inside the Try/Catch but the code is in the other class (in Lib.class in my code). It's not the same class with the BookDetails.class. Do u mean i need to put the .Show() inside the BookDetails.class?
I already try to catch the InvalidCastException when try to binding the picture, u mean i need to catch the InvalidCastException of the other control? is it ur mean?
I only get one catch the InvalidCastException in my BookDetails.class.
Sorry for my language ability. Thanks
Learning .NET
|
|
|
|
|
Every time i set the breakpoint, if i press F8, it will step into "Dim b As Binding...", then "AddHandler..." without going to "Adrressof MyPictureBox_FormatImage", after that "picBook.DataBindings.Add(b)", then step into "oFrmBookDetails.Show()". When showing, it execute the "MyPictureBox_FormatImage" procedure.
I think it should be execute the "MyPictureBox_FormatImage" first, then step into "oFrmBookDetails.Show()". How come it step into "oFrmBookDetails.Show()" first, then going into "MyPictureBox_FormatImage" procedure.
I mean, put a Try/Catch block around the .Show() you have here:
... then step into "oFrmBookDetails.Show()".
The binding format will not get executed until the .Show() method of the form that is hosting the control is executed. This is when your error is occuring.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have put it,it work okay, two message box will displayed as your form1 application. But other problem raise, after formating the binding picture, the form doesn't load correctly. After &qt oFrmBookDetails.Show() &qt executed, it doesn't call frmBookDetails_load. But if i am not formating the binding picture, it will execute the frmBookDetails_load after it execute the &qt oFrmBookDetails.Show() &qt. Is there any other code I need to put to the formBookDetail?
Thanks. Please help me!!!
Learning .NET
|
|
|
|
|
Helo, I have a problem when sending email from VB.Net application, the error message is
"The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for destinationemail@address.com". What is actually is the problem? How can i get out from this problem? Anyone have any idea, please reply. Thanks in advance....
------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
try
Dim objEmailMessage As System.Web.Mail.MailMessage
Dim objSMTPServer As System.Web.Mail.SmtpMail
objSMTPServer.SmtpServer = "mycomputername"
objEmailMessage = New System.Web.Mail.MailMessage
With objEmailMessage
.To = "destinationemail@address.com"
.From = txtFrom.Text
.Subject = "Great Job!"
.Body = "Want all my money?"
End With
objSMTPServer.Send(objEmailMessage)
catch exc as exception
response.write(exc.innerexception.innerexception.message)
end try
End Sub
Learning .NET
|
|
|
|
|
The problem is that it looks like your using your local computer's SMTP server to send this. Most ISP's won't let you do this and will not relay mail for you. Instead, try using your ISP's SMTP server address in the objSMTPServer.SmtpServer line:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim objEmailMessage As System.Web.Mail.MailMessage
Dim objSMTPServer As System.Web.Mail.SmtpMail
objSMTPServer.SmtpServer = "smtp.myISP.com"
objEmailMessage = New System.Web.Mail.MailMessage
With objEmailMessage
.To = "destinationemail@address.com"
.From = txtFrom.Text
.Subject = "Great Job!"
.Body = "Want all my money?"
End With
objSMTPServer.Send(objEmailMessage)
Catch exc as exception
Response.Write(exc.InnerException.InnerException.Message)
End Try
End Sub
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks a lot to all ur guys' reply.
I have successfully sending email. I am using my ISP's SMTP server. I am happy with it.
Thanks
Learning .NET
|
|
|
|
|
You already posted the same question in the General Discussion Forums! Don't cross post.
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
How to add an icon to right click menu when selecting a file or folder.
Installer is going to do this kind of stuff or I can just set it up in
registry? I already defined Directory/Shell/MyApp/Command to add context menu
but i don't know how to add icon.
Shin
|
|
|
|
|
Hi
I have problem the same as you. But I want to know which items You put these keys(HKEY_ CLASSES_ROOT or HKEY_LOCAL_MACHINE)???
Thanks
tramdtt
|
|
|
|
|
|
I have tried but its only correct with several file type!!!
tramdtt
|
|
|
|
|
tramdtt
you are successfull with diplaying icons or just menu without icons.
Can you put what did you put in the registry.
I am still having problem with displaying icon
Shin
|
|
|
|
|
Hi, Shinay
I have still problem with icon of menu item and I have not solved it!!!
Who can help me???
tramdtt
|
|
|
|
|
"Static" menu extensions like you are adding through the registry (under the "shell") subkey don't allow icons. At all. If you want to add a menu item with an icon, you need to write a COM shell extension (context menu handler) which implements IContextMenu. Then you can add items to the supplied HMENU. You can use SetMenuItemBitmaps() to add an icon, but it won't be pretty [like the winzip ones]. If you want a really nice full-colour icon you have to implement IContextMenu2 in your shell extension, add an owner-draw item and draw it yourself.
Hope this helps
grigri
|
|
|
|
|
How do I make the last item added at the end of the text in a rtf control is visible. ie. scroll it so that the bottom of the text is visible.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
Call the ScrollToCaret method of the RichTextBox control.
RichTextBox1.Focus() ' Make sure the RichTextBox has the focus so ScrollToCaret works.
RichTextBox1.Append("some text to append.")
RichTextBox1.ScrollToCaret()
A warning though, the ScrollToCaret method will NOT work if the RichTextBox control does not have the focus.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks Dave, a big help, as ever.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
Hi,
Has anyone developed a custom metadata editor using C#.net or vb.net. if yes, i have a question.
I am trying to develop a custom metadata editor using C#.net. i am using ArcGis 8.3 and Visual studio .net 2003.
when i am trying to execute my custom metadata editor in ArcCatalog it says "Object reference not set to an instance of an object". i don't know where i am going wrong..
I appreciate your help in this regard..
example is given on http://arcobjectsonline.esri.com
Thanks,
abhi
|
|
|
|
|
Just wondering if it is possible to call Library and GetProcAddress from ASP pages or VB scripts.
I know how to do this in VB6 programs from reading some articles on CodeProject. The question is, is the same thing possible in ASP pages or VB scripts? If yes, please let me know.
Thanks.
My articles and software tools
|
|
|
|
|
Nope. You can't call API functions from VBScript or ASP pages.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the answer. Is there a way to get around it? What I want to do is executing code in a non-com dll from ASP pages.
My articles and software tools
|
|
|
|