C #: Press Enter to automatically execute Button1 button

void textBox1_KeyPress Private (Object SENDER, KeyPressEventArgs E)
{
IF (e.KeyChar == '\ R & lt') // determines whether the Enter key is pressed
button1.Focus (); // mouse move the focus to the "Query" button
}

Guess you like

Origin www.cnblogs.com/sunnywam/p/11444078.html