title: Stop application from launching if condition is not met
body: <p>I need to show a message box and then stop my program if a condition is not met, how can I do so?</p>
  
  <p>Right now I have this:</p>
  
  <pre><code>private void MainForm_Load(object sender, EventArgs e){
      if(condition == false){
          MessageBox.Show("Condition not met. Program will now close!");
          Application.Exit();
      }
      new window.ShowDialog();
  }
  </code></pre>
  
  <p>but when I run it, the new window flashes very briefly and the program closes.</p>