web browser problems

Started by
0 comments, last by ApochPiQ 18 years, 4 months ago
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


Advertisement
Can you provide any details on what exactly is going on? What symptoms/behavior are you seeing that indicates that it isn't working?

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

This topic is closed to new replies.

Advertisement