Question

I need to prevent WebBrowser.Navigate() run on the same thread because I need the process to be certain order.

I came across Async/Await implementation of WebBrowser class for .NET which uses async/await implementation but I have to use .net 3.5 which doesn't support it.

Anyone know of any alternative methods?

Was it helpful?

Solution 2

I ended up setting a flag on the main form. Then there is a thread.sleep until the flag is reset.

OTHER TIPS

As far as I understand your requirements, you can use the WebBrowser component's DocumentCompleted event in the following way:

webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(Loaded);
webBrowser.Navigate(...);

...

void Loaded(object sender, WebBrowserDocumentCompletedEventArgs e)
{
    // do stuff that needs to be run after the page is loaded
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top