To login any application by pressing Enter key in the keyboard after entering username and password for that first I am taking two labels, two textboxes and one login button for design.
The design is looks like below:
Then write the following code in Code behind side:
First write the code for login button as per your requirement
private void btnLogin_Click(object sender, EventArgs e)
First check enter key ASCII value with pressing key from keyboard.
Enter key ASCII value is 13.
To know all keyboard keys ASCII values Click Here.
Then write the following code in password textbox key press event :
private void txtPassword_KeyPress(object sender, KeyPressEventArgs e)
Then run your application and give username and password then click enter key then automatically it will login without using mouse.