Results 1 to 2 of 2

Thread: WebBrowser1_DocumentCompleted problem

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2011
    Posts
    467

    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

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,292

    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
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width