Formless class is MTA rather than STA, how do I ma
While my project is STA when I added a class with no form it is executing in an MTA state. I can't find any reference to MTA or STA anywhere in the entire solution. How do I set a class to run in STA rather than MTA mode?
When I try to instantiate a form object from this class with no form, I get an exception of "control cannot be instantiated because the current thread is not in a single-threaded apartment". When I put <STAThread()> Shared Sub Main() Application.Run, GetApartmentState still says MTA from anywhere in the class and the Main never gets called. From the main form of the project GetApartmentState says STA, so somehow the formless class has been switched into an MTA state while the rest of the project is in an STA state. I also tried turning of the application framework off.
|