Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 6, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Using Enter To Tab Forward Through User Entry Fields

When users are comfortable using the Enter key to proceed to the next field, you can allow them to continue their old habits. You need very little coding to accomplish this. Set the KeyPreview property of the form to True, and include the following code:
 Sub Form_KeyDown (KeyCode As Integer, Shift As Integer)
	' To trick the system to think 
	' the Tab key was pressed
	If KeyCode = 13 Then SendKeys "{TAB}"
End Sub

Sub Form_KeyPress (KeyAscii As Integer)
	' To eliminate the annoying beep
	If KeyAscii = 13 Then KeyAscii = 0
End Sub
Gordy Blackwell
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date