Thursday, December 13

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
End If

End Sub


At April 15, 2010 4:40 AM, Anonymous Anonymous said...

Wow! This helps me a lot...
Thanks ben,
Very very very much thanks =)

At March 05, 2011 4:17 PM, Anonymous H. said...

this is amazing
thanks a lot


<< Home