Results 1 to 4 of 4

Thread: Detecting Multiple Keys Being Pressed

  1. #1

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    How do you check to see if someone is pressing multiple keys (i.e.-Alt+F4). Because I need to check and see if the user presses 'SHIFT + TAB' while inside a textbox.

    ------------------
    Ryan

  2. #2
    Lively Member
    Join Date
    Oct 1999
    Location
    Australia
    Posts
    115

    Post

    Use KeyDown event. See VB online help for details.


  3. #3
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    The Keydown Event passes a Shift Value which indicates wether SHIFT,CTRL or ALT is Pressed in Combination with the KeyCode Value, ie.
    Code:
    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
        If KeyCode = vbKeyTab And (Shift And vbShiftMask) = vbShiftMask Then
            Caption = "SHIFT + TAB"
        End If
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Certified AllExperts Expert

  4. #4

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Ya know what though, for some reason I cannot get the KeyDown event to recognize the Tab key. I've used a break point at the beginning of the KeyDown event and it doesn't even go into the event code. I don't know why, everything I've read, says it should work, but it's not working.

    ------------------
    Ryan

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