title: How to create Accept and Cancel Buttons in C#, Visual Studio
body: <p>I am making a Windows Form Application. </p>
  
  <p>I have two buttons (Accept and Cancel) and I want to call the click event for one when Enter is pressed, and the click event for the other when Escape is pressed.</p>
  
  <p>This is a code I've tried (I found it here on a similar question) that didn't work. </p>
  
  <pre><code>  protected override void OnKeyDown(KeyEventArgs e)
      {
           if (e.KeyCode.Equals(Keys.Enter)) {
              this.btnOrder.PerformClick();
          }
           if (e.KeyCode.Equals(Keys.Escape))
           {
               this.btnCancel.PerformClick();
           }
      }
  </code></pre>
  
  <p>I have looked through all the properties and events of the buttons but I cannot find anything Accept or Cancel related. I know that this is probably way too easy but I've learnt of these buttons tonight and I just can't do them.
  Can someone tell me what am I doing wrong?</p>