Link to home
Start Free TrialLog in
Avatar of brl
brl

asked on

combo boxes

I have noticed that using the up/down arrow keys when a combo box is pulled down generates the click event. I want the click event to be generated only if the user clicks on the item with the mouse or presses the ENTER key. How can I overcome this problem?
ASKER CERTIFIED SOLUTION
Avatar of royster
royster

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of royster
royster

This will work better:
Dim ClickFlag As Boolean

Private Sub Combo1_Click()
If ClickFlag = True Then ClickFlag = False: Exit Sub 'reject if arrows used
'enter click code here

End Sub

Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
ClickFlag = False
If KeyCode = 40 Or KeyCode = 38 Then ClickFlag = True
If KeyCode = 13 Then Combo1_Click
End Sub

Avatar of brl

ASKER

royster,

Thank you. I did try it. Seems to do what I want. I appreciate the quick repsonse.

brl.