Webbrowser Component in VB.NET 2005 (Changing URL)

DeltaWolf7

Well-known member
Joined
Jan 21, 2006
Messages
47
Programming Experience
Beginner
I found this code for changing the url or a webbrowser created in VB.NET 2003. The problem is its not compatible with VB.NET 2005, atleast I cant seem to get it to work.

VB.NET:
AxWebBrowser1.Navigate("http://www.microsoft.com", nullObject, nullObjStr, nullObjStr, nullObjStr)

Please could someone tell me how to change the url of a webbrowser on my form. Thank you
 
Simple example here:

Drop a web browser control onto your form and add this code to the Form1_Load event:
VB.NET:
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Form1_Load([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]MyBase[/COLOR][/SIZE][SIZE=2].Load
WebBrowser1.Navigate([/SIZE][SIZE=2][COLOR=#800000]"http://www.microsoft.com"[/COLOR][/SIZE][SIZE=2])
 
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]
[/COLOR][/SIZE]
 
Note also that the ActiveX webbrowser referenced earlier in VS 2003 is different than the one included in VS 2005 (found in Toolbox under Common Controls), the first is a COM object and the latter is a wrapper written specifically for .Net.
 
Back
Top