ActiveX problem

G

Guest

Hi There
Consider the following error that I receive when trying to instantiate the
web browser control:
An unhanded exception of type 'System.Threading.ThreadStateException'
occurred in system.windows.forms.dll
Additional information: Could not instantiate ActiveX control
'8856f961-340a-11d0-a96b-00c04fd705a2' because the current thread is not in
a single-threaded apartment.

Thanks
 
N

Nicholas Paldino [.NET/C# MVP]

Alex,

Do you have the [STAThread] attribute applied to the Main method of your
program? This assumes you are trying to create the web browser control in
the main UI thread.

If not, are you trying to create this in a thread other than the main UI
thread? If so, why? It needs to be a single threaded apartment thread in
order to properly run.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top