[c#] Enter key press in C#

Instead of using Key_press event you may use Key_down event. You can find this as belowEvent
after double clicking here it will automatically this code

private void textbox1_KeyDown(object sender, KeyEventArgs e)
    {

     }

Problem solved now use as you want.

private void textbox1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.Enter)
        {
            MessageBox.Show(" Enter pressed ");
        }
     }