• Advertisement
Sign in to follow this  

web browser problems

This topic is 4460 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am having trouble getting my app to wait until the webbrowser has finished its operations before outputting its data. I quite simple loop until the webBrowser is not busy and for some reason it does not seem to be working.
//before this point webBrowser contains an older page we shall call A
object o = null;
webBrowser.Navigate( "http://www.google.com", ref o, ref o, ref o, ref o);
		
while( webBrowser.Busy )
    Application.DoEvents();

//ideally at this point the webBrowser should contain the page returned from google.com, we shall call it B

mshtml.HTMLDocumentClass doc = new mshtml.HTMLDocumentClass();
doc =   (mshtml.HTMLDocumentClass) webBrowser.Document;
textBox1.Text = doc.documentElement.innerHTML;
//the text that shows up in the textbox is from A, not B
//If I make a button which outputs the current webbrowser document to the textbox 
//and wait a few seconds and manually trigger it, then I get B in my textbox. From 
//my perspective it seems like the while( webBrowser.Busy ) loop is hardly being used


Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement