If you want to catch the 'Enter KeyDown Event for the entire Form ... before any of the Controls on the Form receive the KeyDown Event:
1. set the Form's KeyPreview Property to 'true
2. wire-up an EventHandler for the Form's KeyDown Event:
private bool IsEnterSeen = false;
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
IsEnterSeen = e.KeyCode == Keys.Enter;
}
If you want to get the 'Enter KeyPress Event for the entire Form, and you want to cancel the further processing of the 'Enter key:
private char enterChar = (char)13;
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
IsEnterSeen = e.KeyChar == enterChar;
}