Hi,
I have a listbox which uses two events, the first is the Click event and the other is the KeyDown Event.
If a user clicks on the listbox I want it to do one thing, and if the user spins through using the up and down arrows I want it to do another thing.
My code looks something like this:
Private Sub LstField_Click()
'Do some function 1
End Sub
Private Sub LstField_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyUp Then
'Do Some function 2
ElseIf KeyCode = vbKeyDown Then
'Do Some function 3
End If
End Sub
The problem is that after pressing vbKeyDown or vbKeyup my code runs through the KeyDown event, but then goes on to run through the Click event. Does anyone know a way to stop the click event happening after the keydown event??
Ideas would be gratefully recieved.
Cheers,
Skinicod
I have a listbox which uses two events, the first is the Click event and the other is the KeyDown Event.
If a user clicks on the listbox I want it to do one thing, and if the user spins through using the up and down arrows I want it to do another thing.
My code looks something like this:
Private Sub LstField_Click()
'Do some function 1
End Sub
Private Sub LstField_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyUp Then
'Do Some function 2
ElseIf KeyCode = vbKeyDown Then
'Do Some function 3
End If
End Sub
The problem is that after pressing vbKeyDown or vbKeyup my code runs through the KeyDown event, but then goes on to run through the Click event. Does anyone know a way to stop the click event happening after the keydown event??
Ideas would be gratefully recieved.
Cheers,
Skinicod