WebBrowser control

How can I make the WebBrowser control work in VBE 2005

I keep getting Name "webbrowser1" is not declared in the following line:

webBrowser1.Document.GetElementById("NAME").SetAttribute("Value", "username")

I have added the Microsoft internet controls as as reference.

Thanks,

Antonio



Answer this question

WebBrowser control

  • oasisman

    If you want to have the WebBrowser control on your form you will need to drag and drop the WebBrowser control from the toolbox to the form.

    If you do not need it to be visible you will need to declare and create it before you try to use it.

    Dim webBrowser1 As WebBrowser = New WebBrowser()

    This declaration and creation is done automatically when you drag and drop the control onto a form.



  • KTI

    Hi Andreas,

    Sorry, bear with me.

    When it reaches

    webBrowser1.Navigate("http:/www.yahoo.com/")

    no web page opens up.

    What do I need to do to launch it

    Thanks again.


  • Stijn V

    Hi Andreas,

    I was trying to create a console application, not a Windows application, although I can probably do with a windows one.

    Even if I used the dim above in the console application I would get "class not defined" for WebBrowser.

    Is it not possible to have a webbrowser in a console application

    I basically just want to launch several websites and fill out some ids and passwords by clicling on a icon.

    Many thanks,

    Antonio


  • JordanS

    where did you put

    webBrowser1.Navigate("http:/www.yahoo.com/")

    In what routine Are there error messages



  • Michael Palladino

    It is possible to use in a console application, you will need to import the System.Windows.Forms namespace.

    You can also make windows applications without a form, add a module with a Sub Main() method declared, set is asstartup in the project settings.



  • DavidATaylor

    Did you add the control to a form If you just declare and create it in your code it will not actually be visible.

  • WebBrowser control