title: Why can I not close a form in C#?
body: <p>I cannot close one of my forms programmatically. Can someone help me?</p>
  
  <p>Here's the code:</p>
  
  <pre><code>    private void WriteCheck_Load(object sender, EventArgs e) {
          SelectBankAccountDialog sbad = new SelectBankAccountDialog();
          DialogResult result = sbad.ShowDialog();
          if (result == DialogResult.Cancel) {
              this.Close();
          } else {
              MessageBox.Show(result.ToString());
          }
          MessageBox.Show(sbad.bankaccountID.ToString());
      }
  </code></pre>