After using function key F5 or F10 in a certain field I want the cursor to stay in the field but the cursor is going to another field. Using a function key calls a procedure. Key preview is set to yes. Why my cursor is being moved?
F5 refreshes an object and F10 provides a shortcut key start up, unless you have programmed them to do otherwise, so I think it is default behaviour.
F5 is like reloading the form or firing the current event depending on how you have things setup.
are you using KeyDown Event of the control?
you should clear the keyboard buffer
before executing other commands, eg.
Code:
Private Sub control0_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF5 Or KeyCode = vbKeyF10 Then
KeyCode = 0 '<==== this is what i mean
MsgBox "hello world"
End If
End Sub
are you using KeyDown Event of the control?
you should clear the keyboard buffer
before executing other commands, eg.
Code:
Private Sub control0_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF5 Or KeyCode = vbKeyF10 Then
KeyCode = 0 '<==== this is what i mean
MsgBox "hello world"
End If
End Sub