How would I wait for all objects (images, etc) to load in my webbrowser control, without locking up the form in a loop? Anyone?
Printable View
How would I wait for all objects (images, etc) to load in my webbrowser control, without locking up the form in a loop? Anyone?
The webbrowser has a DocumentCompleted event. That event will fire when the document has finished loading.
Well, i knew that lol, but it doesn't wait until the images have loaded, only the page itself.
This code works for me, it doesn't show the message box until all of the images are loaded:
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.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
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.
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:
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.Quote:
Your submission could not be processed because a security token was missing or mismatched.
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.