Reputation: 4540
If I have
browser.Navigate("http://www.test.com");
In a method, how can I check if it has loaded the webpage from within the same method?
Thanks.
Upvotes: 3
Views: 9040
Reputation: 424
This is Worked For Me:
//Waiting For WebBrowser Load
while(browser.ReadyState == WebBrowserReadyState.Loading) {
Application.DoEvents();
}
//Do Smth.....
Upvotes: 1
Reputation: 225273
To check if it's loaded wherever, do:
if(browser.ReadyState == WebBrowserReadyState.Complete) {
// It's done!
}
However, if you're waiting for it to load, handle the DocumentCompleted
event instead:
browser.DocumentCompleted += WhenItsDone;
Upvotes: 8