title: .NET: How to have Escape close a MessageBox.Show()?
body: <p>Assuming the code:</p>
  
  <pre><code>MessageBox.Show(this, 
         "Would you like the differential girdle spring on the up-end of the grammeters?", 
         "Smi-Boloid Stater Slots", 
         MessageBoxButtons.YesNo, 
         MessageBoxIcon.Warning);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/GUFMo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GUFMo.png" alt="alt text"></a>
  </p>
  
  <p>If the user presses <strong>Escape</strong>, i want it to close the message box, and the <code>Show()</code> method can return <code>DialogResult.None</code>.</p>
  
  <p>Related question: How can i enable the "X" in the upper-right of a MessageBox.Show to let the user abort?</p>
  
  <hr>
  
  <p>Kind of like how a Windows Explorer confirmation dialog lets you press escape to abort.</p>
  
  <p>Kind of like how an Internet Explorer confirmation dialog lets you press escape to abort.</p>
  
  <p>Kind of like how an Outlook confirmation dialog lets you press escape to abort.</p>
  
  <p>Kind of like how every dialog in the history of the universe lets the user press escape ,or click X, in order to say:</p>
  
  <blockquote>
    <p>"I have no earthly idea what you're
    asking me, please just don't break my
    computer."</p>
  </blockquote>
  
  <hr>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/aa511268.aspx" rel="nofollow noreferrer">From the Vista UX Guidelines</a></p>
  
  <blockquote>
    <p><strong>Use Yes and No buttons only to respond to yes or no questions.</strong> The
    main instruction should be naturally
    expressed as a yes or no question.
    Never use OK and Cancel for yes or no
    questions.</p>
  </blockquote>