devxlogo

Using Enter To Tab Forward Through User Entry Fields

Using Enter To Tab Forward Through User Entry Fields

When users are comfortable using the Enter key to proceed to the nextfield, you can allow them to continue their old habits. You need very littlecoding 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 SubSub Form_KeyPress (KeyAscii As Integer)	' To eliminate the annoying beep	If KeyAscii = 13 Then KeyAscii = 0End Sub
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist