using Function key

irade92

Registered User.
Local time
Today, 19:05
Joined
Dec 26, 2010
Messages
229
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?
 
The answer to your question depends on what the procedure does. Please explain this procedure.
 
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
 
The answer to your question depends on what the procedure does. Please explain this procedure.

FOR EXAMPLE F5 CALLS A Procedure that is printing a fiscal bill and then another procedure that saves records...
 
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

Thanks a lot
 

Users who are viewing this thread

Back
Top Bottom