drakeseebo
06-29-2007, 02:38 AM
My WebBrowser control does not seem to be working fully.
I can navigate to pages and do simple stuff like that, but Document.links isn't working. The only thing that is even coming up under .Document is .GetType
Heres my code.
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
Dim i As Object
AxWebBrowser1.Navigate2("www.google.com")
If AxWebBrowser1.Document.links > 0 Then
For i = 0 To AxWebBrowser1.Document.Links.length - 1
If AxWebBrowser1.Document.links(i).href = "http://www.google.com/intl/en/about.html" Then
AxWebBrowser1.Navigate2(AxWebBrowser1.Document.links(i).href)
End If
Next
End If
End Sub
I'm getting this error on "If AxWebBrowser1.Document.links > 0 Then" when trying to run the program.
An unhandled exception of type 'System.NullReferenceException' occurred in microsoft.visualbasic.dll
Additional information: Object variable or With block variable not set.
BTW I'm using Visual Basic .NET 2003
Any ideas? Thanks :D
I can navigate to pages and do simple stuff like that, but Document.links isn't working. The only thing that is even coming up under .Document is .GetType
Heres my code.
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
Dim i As Object
AxWebBrowser1.Navigate2("www.google.com")
If AxWebBrowser1.Document.links > 0 Then
For i = 0 To AxWebBrowser1.Document.Links.length - 1
If AxWebBrowser1.Document.links(i).href = "http://www.google.com/intl/en/about.html" Then
AxWebBrowser1.Navigate2(AxWebBrowser1.Document.links(i).href)
End If
Next
End If
End Sub
I'm getting this error on "If AxWebBrowser1.Document.links > 0 Then" when trying to run the program.
An unhandled exception of type 'System.NullReferenceException' occurred in microsoft.visualbasic.dll
Additional information: Object variable or With block variable not set.
BTW I'm using Visual Basic .NET 2003
Any ideas? Thanks :D