title: WinForm closes even after removing Close()
body: <p>I'm encountering strange behaviour from my WinForms app in VS 2010. I launch a new form using straight-forward code:</p>
  
  <p>MainDisplayForm.cs:</p>
  
  <pre><code>using (MyForm myForm = new MyForm())
  {
      var result = myForm.ShowDialog();
      if (result == DialogResult.OK)
      {
          // do stuff
      }
  }
  </code></pre>
  
  <p>I added a Cancel button to MyForm that displayed a confirmation <code>MessageBox</code> to the user and then called <code>this.Close()</code>. I later <em>removed</em> the <code>this.Close()</code> line because I added a dedicated Close button. However, whenever I press Cancel the instance of MyForm still closes!</p>
  
  <p>MyForm.cs:</p>
  
  <pre><code>private void cmdCancel_Click(object sender, EventArgs e)
  {
      DialogResult result = MessageBox.Show( ... )
      // clear the form if user really wants to quit
  
      // this.Close()
      // even after removing the above line, program still jumps to FormClosing
  }
  </code></pre>
  
  <p>When I debug line-by-line after clicking on the Cancel button, the program flow just jumps to <code>MyForm_FormClosing</code> after it hits the end of <code>cmdCancel_Click</code>. I created a new button and set its click event to <code>cmdCancel_Click</code> and it did not close the form - so the problem is <strong>solved</strong>, but I am still wondering if this is just a bug, or something else? I also made sure to reset the <code>DialogResult</code> property of my Cancel button back to <code>None</code> (after changing it to <code>Cancel</code> before I introduced the dedicated Close button).</p>