CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2008
    Location
    Ukraine, Cherkassy
    Posts
    25

    ThreadStateException

    I get this exception when I tying...

    Code:
    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 .

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: ThreadStateException

    Which thread are you displaying the dialog in?

  3. #3
    Join Date
    Apr 2008
    Location
    Ukraine, Cherkassy
    Posts
    25

    Re: ThreadStateException

    Code:
    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
    Last edited by Mefistos; May 2nd, 2008 at 02:40 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured