DocumentCompleted Event of WebBrowser
MSDN said "the DocumentCompleted event occurs, the new document is fully loaded". That is NOT TRUE. When visiting my blog using WebBrowser, the event was fired up 5 times. When visiting another page, the event was fired up 3 times. It might have something to do with IFrame or Javascript.
In the previous 4 times when the event was fired up, the ReadyState was "Interactive". In the last time, the ReadyState is Complete. So we should modify the function as (VB.NET):
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
DoSomething()
End If
End Sub
2 Comments:
Wow! This helps me a lot...
Thanks ben,
Very very very much thanks =)
this is amazing
thanks a lot
<< Home