Click to See Complete Forum and Search --> : ThreadStateException


Mefistos
May 2nd, 2008, 01:11 PM
I get this exception when I tying...


SaveFileDialog dlg = new SaveFileDialog();

dlg.Filter = "binary files (*.bin)|*.bin";
dlg.FilterIndex = 1;
dlg.RestoreDirectory = true;
dlg.ShowDialog(); //Exception throwed


Function Main() is already marked with attribute [STAThread]
My program consists with many threads .

Arjay
May 2nd, 2008, 02:09 PM
Which thread are you displaying the dialog in?

Mefistos
May 2nd, 2008, 02:33 PM
new Thread
(
delegate()
{
//...
}
).Start();


Exactly I started a windows form (Application.Run()) from new Thread.Start() and that form by button click called this function with problems