Results 1 to 2 of 2

Thread: graphical command button hotkey

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Philippines
    Posts
    49

    Angry

    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

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Location
    Trondheim, Norway
    Posts
    65

    Lightbulb

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width