Key board Buttons

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lee123
    Contributor
    • Feb 2007
    • 556

    Key board Buttons

    Is there a way to pop up a msgbox to say what number a button is on a keyboard is example:

    if i was to press the delete button on my keyboard then a msgbox would pop up and say what number it was.

    is this possible to do?

    lee123
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    you need to capture the keystrokes in the keypress and keydown events.

    Comment

    • lee123
      Contributor
      • Feb 2007
      • 556

      #3
      and how is this done, or how would i get the keystokes?

      lee123

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        you need to capture the keyascii and keycode in the specified events.

        Comment

        • vacvac
          New Member
          • Jun 2009
          • 6

          #5
          Code:
             
                Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
            
                  If  KeyCode = vbKeyDelete Then ...
           
                End Sub
          Hope this help

          Comment

          • vacvac
            New Member
            • Jun 2009
            • 6

            #6
            There is some code that can help you , click here

            Comment

            • harshadd
              New Member
              • Dec 2007
              • 180

              #7
              You need to capture the keystrokes in the keypress and keydown events.
              and for more specific message use an IF loop or case loop.

              Comment

              • smartchap
                New Member
                • Dec 2007
                • 236

                #8
                Use following sub:

                Code:
                Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
                    MsgBox KeyCode
                    
                End Sub

                Comment

                Working...