title: Escape key is closing a Windows Forms form with no code or settings tied to it
body: <p>I am using VB.NET in Visual&nbsp;Studio&nbsp;2010 targeting .NET Framework 3.5.</p>
  
  <p>In our (rather large) client application, there's one form (<a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="nofollow">Windows Forms</a>) we're having an issue with. It's displayed with .ShowDialog (it's not the only form displayed with .ShowDialog). There are Close and Cancel buttons on the form, and the Enter key and Escape key, respectively, are tied to these controls (and that's also done on other forms). The code in the buttons performs a Hide method call to make the form not visible (it's actually unloaded later in the business process logic), and again we do this elsewhere with other forms.</p>
  
  <p>Clicking the Close or Cancel buttons works as desired. Pressing the <kbd>Enter</kbd> key also works as desired (Close click is run). But when the Escape key is pressed, first the Cancel button logic is run, as expected, but then we receive a Form Closed event, and the form is unloaded!</p>
  
  <p>There is no code elsewhere looking for the Escape key and performing an Close on the form. We tried to set the Cancel argument in the Closing event, but to no avail - the form still unloads. We also disconnected the Escape key from the Cancel button, pressing Escape then doesn't run the Cancel code (as then expected), but the Form Closed event still fires.</p>
  
  <p>I haven't been able to replicate this behavior in a test program, so unfortunately I can't post a working (non-working, actually) code example.</p>
  
  <p>Any input as to what's going on? Why is the Escape key closing the form?</p>
  
  <p>Perhaps most importantly, what do I need to do to investigate this further and figure it out?</p>