WebBrowser1_DocumentCompleted problem
This is very frustrating :/
I have spent ages on this and just can not figure it out
Code:
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
MsgBox("this is a test")
End Sub
When the form opens i have the webbrowser url set to a website, the site opens fine but i get it doing the msgbox 3 times :/
How do i get it to do it just once ?
I think the reason is for images loading onto the site or something IDK
Thanks for any help
Re: WebBrowser1_DocumentCompleted problem
You test the WB.ReadyState and make sure it is WebBrowserReadyState.Complete before proceeding.
Code:
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
MsgBox("this is a test")
End If
End Sub