title: STAThread error (SaveFileDialog) on a new Form
body: <p>So basicaly i have made a login system for my program, and when a user logs it it opens up Form1. But i need the Form1 to be a STA thread.
  I am getting this error in Form1:</p>
  
  <blockquote>
    <p>{"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."}
    In this code </p>
  </blockquote>
  
  <pre><code>SaveFileDialog FSave = new SaveFileDialog()
          {
              Filter = "Executable Files|*.exe",
              InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
          };
          if (FSave.ShowDialog() == DialogResult.OK)//im getting the error here
          {
          // CodeDom compiler code
          }
  </code></pre>
  
  <p>this is my Program.cs</p>
  
  <pre><code>using System;
  using System.Windows.Forms;
  namespace hwid_login_system
  {
      static class Program
      {
          [STAThread]
          static void Main()
          {
              Application.EnableVisualStyles();
              Application.SetCompatibleTextRenderingDefault(false);
              Application.Run(new Login());
          }
      }
  }
  </code></pre>
  
  <p>This is how i open form Form1 in form Logins</p>
  
  <pre><code>private void complete()
      {
          if (loggedin &amp;&amp; hwid)
          {
              MessageBox.Show("Logged in successfully!");
              System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadProc));
              t.Start();
              this.Close();
          }
          else
              MessageBox.Show("Something else went wrong..", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
      }
  public static void ThreadProc()
      {
          Application.Run(new Form1());
      }
  </code></pre>