I tried this code:
private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (Convert.ToInt32(e.KeyChar) == 13) { MessageBox.S
KeyChar is looking for an integer value, so it needs to be converted as follows:
private void Form1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == Convert.ToInt16(Keys.Enter)) { MessageBox.Show("Testing KeyPress"); } }