boogieoompa
09-04-2003, 10:42 PM
I want to execute a command when ever the user holds the down key and up key down. How do I do this using the vbKey up and down event. I already know about the timers but how do you specify that the down key will execute an event?
Diurnal
09-04-2003, 11:09 PM
I want to execute a command when ever the user holds the down key and up key down. How do I do this using the vbKey up and down event. I already know about the timers but how do you specify that the down key will execute an event?
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'Check for Up or Down arrow.
If KeyCode = vbKeyDown Or KeyCode = vbKeyUp Then
'Do something here...
Else
'Do nothing.
End If
End Sub
Make sure you set the Form's KeyPreview Property to True. This will let the Form intercept the input to the Controls so that you can process the inputs and do what you want to do before passing them to the Controls.