I'm trying to access a website through the WebBrowser and this morning suddenly the following error appeared
You can not create an instance of the ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' because the current thread is not in a STA (single-threaded apartment).
I can not solve it, because I had never been in contact with this type of error.
Following is part of the code:
string sSite = "http://online.sefaz.am.gov.br/diselada/consultadi.asp";
Uri sUri = new Uri(sSite);
WebBrowser webSiscomex = new WebBrowser();
webSiscomex.AllowNavigation = true;
webSiscomex.Navigate(sSite);
webSiscomex.Width = 700;
webSiscomex.Height = 500;
webSiscomex.Visible = true;
webSiscomex.ScrollBarsEnabled = false;
webSiscomex.ScriptErrorsSuppressed = true;
webSiscomex.Show();