Hello,
In my application, when i am trying to open a OpenFileDialog, i am getting an error as:
"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".
I did added [STAThread] attribute to my main function but still i am getting this error.
In my main form, i am opening another form as ShowDialog() and inside that form i am trying to call OpenFileDialog(), is this not allowed?
Please tell me what i am doing wrong.
Thanks,
Nagendra.