Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Home » Tip Bank » .NET » C#
Language: .NET
Expertise: Beginner
Jun 8, 2017

Using the Enter Key to Navigate to the Next Control in C#

There are cases in which you would need the Enter key to operate as the Tab key. In order for the Enter key to be used as a Tab key, you could use code similar to the following:

private void Text1_KeyPress(object sender, KeyPressEventArgs e)
            if (e.KeyChar == 13) //Determine Enter
                SendKeys.Send("{TAB}"); //???Fake??? Tab press
                e.Handled = true;
Hannes du Preez
Thanks for your registration, follow us on our social networks to keep up-to-date