Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 775.6k

Enter Key Finction in C#

May 28 2013 7:58 AM
Sir, I have about 20 textBoxe ,10 comboBox and 5 dateTimePicker in a form.

as I want to go cursor downward through each textbox whenever I press 'Enter' Key.

I coded:-

if(e.KeyCode==Keys.Enter)
{
txtLastName.Focus()// goes from txtFirstName to txtLastName
}


I am tired of writing this code in each textBox of my form.

is there an unique code to define these function  in a form, i.e keydown event defines for 25 textboxes.?

Answers (4)