shr6557
December 22nd, 2006, 01:28 PM
hello
i want get file with OpenFileDialog class
i use this code
OpenFileDialog ^chooser = gcnew OpenFileDialog;
chooser->ShowDialog;
i dubug my program , this is not have error but when my program must show FileDialog compiler break my program and show this error
A first chance exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll
An unhandled exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll
Additional information: 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.
plz help me!
tnx
i want get file with OpenFileDialog class
i use this code
OpenFileDialog ^chooser = gcnew OpenFileDialog;
chooser->ShowDialog;
i dubug my program , this is not have error but when my program must show FileDialog compiler break my program and show this error
A first chance exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll
An unhandled exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll
Additional information: 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.
plz help me!
tnx