how to make pressing enter an event in c# code example
Example 1: c# keyboard enter
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
MessageBox.Show("Enter pressed");
}
}
Example 2: winforms how to check for enter key
//add the handler to the textbox
this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(CheckEnterKeyPress);