Freigeben über


ActiveX control cannot be instantiated because the current thread is not in a single-threaded apartment.

If you are getting error saying "ActiveX control cannot be instantiated because the current thread is not in a single-threaded apartment." then you need to apply STAThreadAttribute attribute to the entry point method.

Ex -

        [STAThread]
        static void Main(string[] args)
        {  
        }

This attribute indicates that the COM threading model for an application is single-threaded apartment (STA).

for more details please refer https://msdn.microsoft.com/en-us/library/system.stathreadattribute.aspx.