What's the best way to code in a wait for the browser to finish process before continuing? I tried this code below and the process is not waiting till its complete before processing the next link.
void WaitBrowserLoading()
{
while (webBrowser1.IsBusy)
Application.DoEvents();
for (int i = 0; i < 500; i++)
if (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
lblStoreID.Text = "";
//System.Threading.Thread.Sleep(5);
}
else
break;
Application.DoEvents();
}