Click here to Skip to main content
15,914,594 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
ActiveX control 'd27cdb6e-ae6d-11cf-96b8-444553540000' cannot be instantiated because the current thread is not in a single-threaded apartment.

how can i solve this
i add two forms when i click the form 1 button i want open the form2 in form2 i added axShockwaveFlash1 when i run the form2 that time i am getting the this error
Posted

1 solution

The problem you're running into is that most background thread / worker APIs will create the thread in a Multithreaded Apartment state. The error message indicates that the control requires the thread be a Single Threaded Apartment.

You can work around this by creating a thread yourself and specifying the STA apartment state on the thread.

From this link:
http://stackoverflow.com/questions/1418466/single-threaded-apartment-cannot-instantiate-activex-control[^]

var t = new Thread(MyThreadStartMethod);
t.SetApartmentState(ApartmentState.MTA);
t.Start();


Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900