• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

Using Arrow Keys in VB5

I'd like to know how to detect the user pressing the arrow keys in vb5. A little example source would be plus :). And hey, it's worth 200 points.
  • 2
1 Solution
Make a new project, draw a textbox on the form, let VB name it.

Paste-in this code.

Option Explicit
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)

    Select Case KeyCode
        Case vbKeyUp
            MsgBox "Up Arrow Was Pressed on Text1"
        Case vbKeyDown
            MsgBox "Down Arrow Was Pressed on Text1"
        Case vbKeyLeft
            MsgBox "Left Arrow Was Pressed on Text1"
        Case vbKeyRight
            MsgBox "Right Arrow Was Pressed on Text1"
    End Select
End Sub

Oh.... if you need any more, just ask.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now