title: Detect Enter Key C#
body: <p>I have the following code which does not show the MessageBox when enter/return is pressed.</p>
  
  <p>For any other key(i.e. letters/numbers) the MessageBox shows False.</p>
  
  <pre><code>private void cbServer_TextChanged(object sender, EventArgs e)
  {
      if (enterPressed)
      {
          MessageBox.Show("Enter pressed");
      }
      else
          MessageBox.Show("False");
  }
  
  private void cbServer_Keydown(object sender, KeyEventArgs e)
  {
      if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
      {
          enterPressed = true;
          MessageBox.Show("Enter presssed: " + enterPressed);
  
      }
      else
          enterPressed = false;
  }
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>EDIT: Above code, I thought the issue was with the _Keydown even so I only posted that.</p>