Friday, March 21, 2008

ThreadStateException

ThreadStateException C# code

Exception:

System.Threading.ThreadStateException was unhandled
Message="Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process.

Solve:

# แก้ที่ program ข้างบนเมธอด Main (Program.cs) ให้ใช้ [STAThread]

1 comment:

Popular Posts