I know it must be the abc of programing but, can somebody
tell me how can i make, so when i press enter in a
textbox then other textbox getfocus???
Printable View
I know it must be the abc of programing but, can somebody
tell me how can i make, so when i press enter in a
textbox then other textbox getfocus???
Code:Public Sub TextBox1_KeyPress(KeyAscii As Integer)
' Check if return has been pressed
If KeyAscii = vbKeyReturn Then TextBox2.SetFocus
End Sub
Thanks Stevie it worked perfectly!!
What you can do if you got multi textboxes.
Just create the indexes on it. :)Code:Public Sub TextBox_KeyPress(Index As Integer, KeyAscii As Integer)
' Check if return has been pressed
If KeyAscii = vbKeyReturn Then TextBox.Item(Index + 1).SetFocus
End Sub
Code:TextBox.Index = 0 'ext, ext.
...or if you don't have the text boxes in an array just change the Return to a Tab
Good luck!Code:Public Sub TextBox_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
KeyAscii = 0
SendKeys "{TAB}"
End If
End Sub