Results 1 to 6 of 6

Thread: [VB2008] Wait for all objects in axwebbrowser to load?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    128

    [VB2008] Wait for all objects in axwebbrowser to load?

    How would I wait for all objects (images, etc) to load in my webbrowser control, without locking up the form in a loop? Anyone?

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [VB2008] Wait for all objects in axwebbrowser to load?

    The webbrowser has a DocumentCompleted event. That event will fire when the document has finished loading.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    128

    Re: [VB2008] Wait for all objects in axwebbrowser to load?

    Well, i knew that lol, but it doesn't wait until the images have loaded, only the page itself.

  4. #4
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [VB2008] Wait for all objects in axwebbrowser to load?

    This code works for me, it doesn't show the message box until all of the images are loaded:
    Code:
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            WebBrowser1.Navigate("http://gettyimages.com/Editorial/News.aspx")
    
        End Sub
        Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
            MessageBox.Show("Done!")
        End Sub
    Now if there is some javascript that is pulling down the images, I could understand why that wouldn't be done downloading when the images are still loading.

    Think of something like google maps, that pulls down the images as you drag and move the map, but the page has been long since loaded. If you are trying to trap something like that, I think it is going to be more difficult.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    128

    Re: [VB2008] Wait for all objects in axwebbrowser to load?

    that doesn't work for me, I'm trying to communicate with a vBulletin forum, but because all the objects don't seem to be loaded it keeps giving me this error:

    Your submission could not be processed because a security token was missing or mismatched.
    And it's on almost every board I try. The only explanation that I see is plausible is that the hidden form for the security token hasn't loaded yet.

  6. #6
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [VB2008] Wait for all objects in axwebbrowser to load?

    If you put in a 10 second wait after you start loading, does it work? If it does, then you can work on figuring out how to avoid using that 10 second delay.

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