Combobox and F4 key

SiX

Member
Joined
Dec 23, 2007
Messages
5
Programming Experience
1-3
Hi Guys

I want to change the F4 key on the combo box in vb.net 2005

By default, if the combo box has focus, and you press F4, it will open/drop down.

F4 is already used in my program, is it possible to change the key to for example F5?

Thank you very much.
 
you can change the key to any key you choose

VB.NET:
Private Sub ComboBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
     If e.KeyCode = Keys.F4 Then
         e.SuppressKeyPress = True
     ElseIf e.KeyCode = Keys.F5 Then
         If Not ComboBox1.DroppedDown = True Then
             ComboBox1.DroppedDown = True
         Else
             ComboBox1.DroppedDown = False
         End If
     End If
End Sub
 
Back
Top