Click here to Skip to main content
15,912,504 members
Please Sign up or sign in to vote.
1.40/5 (3 votes)
See more:
hi all dev,
what can i do when i want to go to next TabIndex in my windows form by pressing Enter key???????????
please help me
Posted

I would strongly suggest that you don't.

"Normal" users are used to some keys doing specific things in all windows apps: TAB takes you to the next control, SHIFT+TAB takes you to the previous. ENTER presses the "OK" button - or whatever button is highlighted.

Not only is it a fair amount of work to subvert this mechanism, but it will also make your application non-standard, and annoys users, and makes them less willing to use your application.
 
Share this answer
 
Comments
daghune 15-Aug-12 2:45am    
my boss said me to implement this mechanism to make application's users work faster.I have no choice,man
OriginalGriff 15-Aug-12 3:08am    
Then your boss is an idiot.
Go, explain what I said above, and see what he says. Remember that if you want your app to be used, then users have to like it - not be frustrated because it "doesn't work" - and they really can't be bothered to read the manual.
C#
private void Form_KeyDown(object sender, KeyEventArgs e)
{
    if(Keys.Enter == e.KeyCode)
    {
       SendKeys.Send("{TAB}");
       e.Handled = true;//set to false if you need that textbox gets enter key
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900