المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : .Net WebBrowser control wont instanciate on form in new thread?



C# Programming
05-25-2009, 02:00 AM
Hi, In my application i need to open 2 forms. After the first form is loaded, iti loads a second form with the following..


System.Threading.Thread MainFormThread = new System.Threading.Thread(new System.Threading.ThreadStart(OpenMainForm));
MainFormThread.Start();
System.Threading.Thread.Sleep(1500);

Where OpenMainForm() just has Application.Run(new MainForm());

The MainForm has a webbrowser control, and it will not compile due to the error:

ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment.

Does anyone know how i can solve this issue?

Thanks for reading.
Andy