C# WinForms: How to set Main function STAThreadAttribute

Solution very easy;
Just add this on top of the Main method [STAThread]

So your main method should look like this

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

It works for me.

Leave a Comment