Connecting Tech Pros Worldwide Help | Site Map

can i use the Enter key instead of the tab key in entering data to textbox?

Newbie
 
Join Date: Sep 2009
Posts: 4
#1: Sep 1 '09
After entering data in the first text box I want to make the second text box to get focus when the Enter key is pressed instead of Mouse and Tab control.
Is there any way to do that by making the key values of the Tab key and the Enter key?
tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,745
#2: Sep 1 '09

re: can i use the Enter key instead of the tab key in entering data to textbox?


For textbox1 create a handler for the Keypress event.
In that event handler you can put in a switch/case construct to check if the keypress was tab or enter then set the focus to the next control.

Remember it is also preferable to set up the tab order in visual studio so tabbing works in the order the user would expect. From the 'View' menu select 'Tab order', then click on the controls in the order you want them to be tabbed through. Just follow the numbers.
Newbie
 
Join Date: Sep 2009
Posts: 4
#3: Sep 2 '09

re: can i use the Enter key instead of the tab key in entering data to textbox?


Please give me an example.
ThankU in advance for u'r prompt responce.
Newbie
 
Join Date: Sep 2009
Posts: 4
#4: Sep 4 '09

re: can i use the Enter key instead of the tab key in entering data to textbox?


could i get an example about using the Enter key instead of the tab key to get the focus from textbox1 to textbox2 , when the Enter key is pressed after the data is filled in to textbox1..
tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,745
#5: Sep 4 '09

re: can i use the Enter key instead of the tab key in entering data to textbox?


Quote:

Originally Posted by Tlhintoq

For textbox1 create a handler for the Keypress event.
In that event handler you can put in a switch/case construct to check if the keypress was tab or enter then set the focus to the next control.

Did you make an effort do try my first suggestion? If you are having some trouble with the code you tried, please post it and we'll see what we can do to clean up your efforts.
Reply


Similar Visual Basic .NET bytes