Alberto071397
asked on
How to jump to the next control by using the ENTER key
Let's have a form with several text boxes. The tab order has been set as needed and is working as expected. After the user fills each text box, the tab key moves the focus to the next text box and so on. I need suggestions on what would be the most convenient method to allow the user to go to the next text box by using the ENTER key as an alternate key?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I like the SendKeys.SendWait with the {Tab} key the best, then you don't need to specify a control to focus to.
Bob
Bob
This is what I use:
private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEv entArgs e)
{
if (e.KeyCode == Keys.Enter)
{
SendKeys.SendWait("{Tab}") ;
e.Handled = true;
}
}
Bob
private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEv
{
if (e.KeyCode == Keys.Enter)
{
SendKeys.SendWait("{Tab}")
e.Handled = true;
}
}
Bob
http://www.c-sharpcorner.com/Code/2004/March/EnterTabKeys.asp