I thought this might be simple but i guess it’s not, i have like 100 websites i need to load into a browser. I’ve loaded them into a List but my foreach happens before the website loads. Does anybody have a way to make each of these load and actually process WebBrowserDocumentComplete before loading the next one? queue doesn’t work.
foreach(string oneWebsite in ALLWebSites)
{
webBrowser1.Navigate(oneWebsite);
webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
//do work
}
An AutoResetEvent should work
http://msdn.microsoft.com/en-us/library/system.threading.waithandle.waitone(v=vs.71).aspx