webbrowser control in a module

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pmclinn

    #1

    webbrowser control in a module

    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.Nav igate("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.Doc ument.All("txtT o")
    l.InnerText = "Email@aol. com"
    l = WebBrowser1.Doc ument.All("txtF rom")
    l.InnerText = "Email@aol. com"
    l = WebBrowser1.Doc ument.All("txtS ubject")
    l.InnerText = "Testing Document"
    l = WebBrowser1.Doc ument.All("txtB ody")
    l.InnerText = ("Testing Body")
    l = WebBrowser1.Doc ument.All("btnS ubmit")
    l.InvokeMember( "Click")

    quit += 1
    End If
    WebBrowser1.Dis pose()

    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.

  • Herfried K. Wagner [MVP]

    #2
    Re: webbrowser control in a module

    "pmclinn" <pmclinn@gmail. comschrieb:
    >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.Nav igate("http://website")
    I assume the actual window handle of the webbrowser control cannot be
    created if it doesn't get added to a form's or control's 'Controls'
    collection.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

    Comment

    Working...