Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can I use up, down, left and right arrow keys of my keyboard in windows application in C# 2008 for moving among the form on runtime.
Posted
Updated 24-Nov-10 0:20am
v4
Comments
Dr.Walt Fair, PE 24-Nov-10 0:55am    
Since I have no idea what controls are on your form, it's impossible to answer your question, but I'd suggest that you stick with the default behavior, since that is probably what your users are expecting.

For example, do you want the arrow keys to move to a different control? What if the control is a TextBox? Should the arrows stop selecting the text position in the TextBox? What about a GridView?

1 solution

As suggested by Walt - use the default navigation option using the tab key. This will not confuse the users.

If you insist on using the arrow keys (I hope I never see your app) then you need to trap the keypress\down\up event, decide where you are on the form, locate the next control in the direction you want and select/ set focus on that control.
 
Share this answer
 
Comments
Toli Cuturicu 24-Nov-10 5:38am    
I also don't like applications with non standard UI conventions.

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