Hi...
How to move cursor using Enter Key ( Key Press )from field to field.
Printable View
Hi...
How to move cursor using Enter Key ( Key Press )from field to field.
'Try this code
'Assuming that you have an array of text boxes named txtCtl
Sub txtCtl_Keypress(Index as Integer, KeyAscii as Integer)
If KeyAscii = 13 And Index < txtCtl.Count - 1 Then
txtCtl(Index + 1).SetFocus
End If
End Sub
Thanks for your response...
And how if i've an array Text Box and Combo Box.
Try this:
-------------------------------------------------
Sub ChangeFocus(KeyAscii as Integer)
If KeyAscii = 13 Then SendKeys "{TAB}"
End Sub
-------------------------------------------------
You can use the ChangeFocus sub procedure by calling it from the KeyPress event of any control. You have to pass KeyAscii to this procedure.
For example:
-------------------------------------------------
Sub txtEmployeeId_KeyPress(KeyAscii As Integer)
ChangeFocus KeyAscii
End Sub
-------------------------------------------------