-
how can i make hotkeys for graphical command buttons? I know its easy if i have a standard-command button (i will just have to use the ampersand & command right?) my command button does not use captions but i need to have a hotkey for it. Hope you guys can help me ASAP.
thanks
-
Set Form1.KeyPreview to True
Paste this code into Form_KeyDown...
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'This fires Command1_Click event if Shift + A is pressed...
If Shift = 1 Then
If KeyCode = 65 Then 'KeyCode 65 is "A"
Command1_Click 'Fires the Click event...
End If
End If
End Sub
Search for KeyCode in MSDN library to get all the code values...
Shift has (at least) these values)
1 = Shift
2 = Ctrl
4 = Alt
Somehow Alt Gr also is 1...
Hope this helps...
D