title: C#: How to prevent main form from showing too early
body: <p>In my main method, I start the main form as usual:</p>
  
  <pre><code>        Application.EnableVisualStyles();
          Application.SetCompatibleTextRenderingDefault(false);
          Application.Run(new MainForm());
  </code></pre>
  
  <p>In the main forms load thing I have the following, which will ask the user to log in and stuff.</p>
  
  <pre><code>        using (loginForm)
          {
              DialogResult r = loginForm.ShowDialog();
              switch (r)
              {
                  case DialogResult.OK:
                      break;
                  default:
                      Application.Exit();
                      return;
  
              }
          }
  </code></pre>
  
  <p>My problem is that the main form shows up in the background, and I want it to, well... not. until the login is ok. How should I do this? The Application.Run() method say it automatically shows the form. Is there an alternative way of starting the main form without showing it? Or do I have to set visible to false in the constructor of the main form, and then back to true when log in is done, or something similar? What is the recommended way of doing something like that? The login forms intention is like a combined splash screen and login. So first it loads and sets up some different things, and then it tells the user to login. </p>