K
Kiks
I've got a question about a thread that waits for another. But the
documentCompleted event never fires...
This is the code:
public System.Windows.Forms.HtmlDocument doc;
System.Threading.AutoResetEvent timer = new
System.Threading.AutoResetEvent(false);
....
public System.Windows.Forms.HtmlDocument ApriIE()
{
System.Windows.Forms.WebBrowser browser = new
System.Windows.Forms.WebBrowser();
browser.DocumentCompleted += new
System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted);
browser.Navigate(vPostehRef, false);
System.Windows.Forms.Application.DoEvents();
timer.WaitOne();
doc = browser.Document;
return doc;
}
public void browser_DocumentCompleted(Object sender,
WebBrowserDocumentCompletedEventArgs e)
{
timer.Set();
}
documentCompleted event never fires...
This is the code:
public System.Windows.Forms.HtmlDocument doc;
System.Threading.AutoResetEvent timer = new
System.Threading.AutoResetEvent(false);
....
public System.Windows.Forms.HtmlDocument ApriIE()
{
System.Windows.Forms.WebBrowser browser = new
System.Windows.Forms.WebBrowser();
browser.DocumentCompleted += new
System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted);
browser.Navigate(vPostehRef, false);
System.Windows.Forms.Application.DoEvents();
timer.WaitOne();
doc = browser.Document;
return doc;
}
public void browser_DocumentCompleted(Object sender,
WebBrowserDocumentCompletedEventArgs e)
{
timer.Set();
}