P
pmclinn
I have some webbrowser code using the .net 2.0 control on a form. I
want to remove the form and run the proceedure from a module but I
cannot seem to get the code to work.
Code in form that works:
WebBrowser1.Navigate("http://website")
in the completed event handler I have this
Static quit As Integer = 0
If quit = 0 Then
Dim l As HtmlElement
l = WebBrowser1.Document.All("txtTo")
l.InnerText = "(e-mail address removed)"
l = WebBrowser1.Document.All("txtFrom")
l.InnerText = "(e-mail address removed)"
l = WebBrowser1.Document.All("txtSubject")
l.InnerText = "Testing Document"
l = WebBrowser1.Document.All("txtBody")
l.InnerText = ("Testing Body")
l = WebBrowser1.Document.All("btnSubmit")
l.InvokeMember("Click")
quit += 1
End If
WebBrowser1.Dispose()
This code works in the form but when I move it into a sub main
proceedure it doesn't work. How do I make this work? I created a
public variable:
Public webb withevents as webbrowser
and added in the completed event but the code is not running. Help.
want to remove the form and run the proceedure from a module but I
cannot seem to get the code to work.
Code in form that works:
WebBrowser1.Navigate("http://website")
in the completed event handler I have this
Static quit As Integer = 0
If quit = 0 Then
Dim l As HtmlElement
l = WebBrowser1.Document.All("txtTo")
l.InnerText = "(e-mail address removed)"
l = WebBrowser1.Document.All("txtFrom")
l.InnerText = "(e-mail address removed)"
l = WebBrowser1.Document.All("txtSubject")
l.InnerText = "Testing Document"
l = WebBrowser1.Document.All("txtBody")
l.InnerText = ("Testing Body")
l = WebBrowser1.Document.All("btnSubmit")
l.InvokeMember("Click")
quit += 1
End If
WebBrowser1.Dispose()
This code works in the form but when I move it into a sub main
proceedure it doesn't work. How do I make this work? I created a
public variable:
Public webb withevents as webbrowser
and added in the completed event but the code is not running. Help.