Click to See Complete Forum and Search --> : up/down arrow ASCII controls


January 4th, 2000, 03:23 PM
i am looking for the ASCII numbers for:
DELETE (the button)
Up arrow
Down arrow
Left arrow
Right arrow

ASCII numbers as in 13 = ENTER, etc...

Chris Eastwood
January 4th, 2000, 04:11 PM
How about using the built in vb constants, eg :


private Sub Form_Load()
Debug.print "Delete = " & vbKeyDelete
Debug.print "Up = " & vbKeyUp
Debug.print "Down = " & vbKeyDown
Debug.print "Left = " & vbKeyLeft
Debug.print "Right = " & vbKeyRight
Debug.print "Enter = " & vbKeyReturn
End Sub




That should produce :

Delete = 46
Up = 38
Down = 40
Left = 37
Right = 39
Enter = 13


Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb

Richard Barnes
January 4th, 2000, 04:31 PM
The easiest way to find any key code is to insert the following line into a form and run the program.

private Sub Form_KeyDown(KeyCode as Integer, Shift as Integer)
Debug.print "Down " & chr(KeyCode) & " Number = " & KeyCode
End Sub




Puch keys to your hearts content

Richard

January 5th, 2000, 01:26 AM
What are you planning to do with arrow keys? These may work on a form which has no command buttons. Since these are used to move through the various controls on the form. The Form_KeyPreview may allow you to trap all keys except these arrow keys. You are better off using a form without any command buttons, use stylish 3DPanels instead.
Another option for you might be as follows.
Use number keys on the NumPad with the NumLock ON.