Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

Move to the next Text Box function

How can i make it that when you press enter you move to the next text box

I have tried

If keyascii = 13 then text1.SetFocus

and other things

any ideas?
0
Matthew Tandy
Asked:
Matthew Tandy
  • 2
1 Solution
 
JacamarCommented:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text2.SetFocus
End Sub

This works for me
0
 
JacamarCommented:
just make sure it's in the keypress event
0
 
JohnMcCannCommented:
The alternative approach would be

Private Sub Text1_KeyPress(KeyAscii As Integer)
   If KeyAscii = vbKeyReturn Then SendKeys vbTab
End Sub


0
 
PiterCommented:
Private Sub txt1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
 SendKeys "{TAB}"
End If
End Sub
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now