I have my main gui class with some subclassess. There are +- 3 threads that are collecting data from various internet sources and API gateways etc.
Now, out of one o
This should work
var th = new Thread(() =>
{
WebBrowserDocumentCompletedEventHandler completed = null;
using (WebBrowser wb = new WebBrowser())
{
completed = (sndr, e) =>
{
//Do Some work
wb.DocumentCompleted -= completed;
Application.ExitThread();
};
wb.DocumentCompleted += completed;
wb.Navigate(url);
Application.Run();
}
});
th.SetApartmentState(ApartmentState.STA);
th.Start();
th.Join();
that said, I would use WebClient or HttpWebRequest together with HtmlAgilityPack to download and parse html resources