Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hi, i m developing a windows forms application using MC++, when i do debug the project , it fails in the line of ' openFileDialog1->ShowDialog(); ' and gives an error like that :

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.

 

But its already done in Form1.cpp like that :

System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA;

 

i mean the current apartmentstate is already set as STA... i cant debug the project cos of that error...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...