PDA

View Full Version : VB key Codes



nzxtnemesis
01-28-2010, 11:57 PM
I know i needed these a while back for ASCII keys in VB
Here is a list of all the key codes for vb.. Some might have already seen 13 for ENTER
This took me a while to compile because the spacing was really bad.

USAGE

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then ' if enter is pressed then
'somethinghere
KeyAscii = 0
End If
End Sub



Key Codes

[Key Code Constants]
vbKeyLButton (1) - LButton

vbKeyRButton (2) - RButton

vbKeyCancel (3) - Cancel

vbKeyMButton (4) - MButton

vbKeyBack (8) - Back

vbKeyTab (9) - Tab

vbKeyClear (12) - Clear

vbKeyReturn (13) - Return

vbKeyShift (16) - ShiftKey

vbKeyControl (17) - ControlKey

vbKeyMenu (18) - Menu

vbKeyPause (19) - Pause

vbKeyCapital (20) - Capital

vbKeyEscape (27) - Escape

vbKeySpace (32) - Space

vbKeyPageUp (33) - PageUp

vbKeyPageDown (34) - PageDown

vbKeyEnd (35) - End

vbKeyHome (36) - Home

vbKeyLeft (37) - Left

vbKeyUp (38) - Up

vbKeyRight (39) - Right

vbKeyDown (40) - Down

vbKeySelect (41) - Select

vbKeyPrint (42) - Print

vbKeyExecute (43) - Execute

vbKeySnapshot (44) - Snapshot

vbKeyInsert (45) - Insert

vbKeyDelete (46) - Delete

vbKeyHelp (47) - Help

vbKeyNumlock (144) - NumLock

vbKeyScrollLock (145) - Scroll


[Alphabetic Key Code Constants]
VbKeyA (65) - A

VbKeyB (66) - B

VbKeyC (67) - C

VbKeyD (68) - D

VbKeyE (69) - E

VbKeyF (70) - F

VbKeyG (71) - G

VbKeyH (72) - H

VbKeyI (73) - I

VbKeyJ (74) - J

VbKeyK (75) - K

VbKeyL( 76) - L

vbKeyM (77) - M

VbKeyN (78) - N

VbKeyO (79) - O

VbKeyP( 80) - P

VbKeyQ (81) - Q

VbKeyR (82) - R

VbKeyS (83) - S

VbKeyT (84) - T

VbKeyU (85) - U

VbKeyV (86) - V

VbKeyW (87) - W

VbKeyX (88) - X

VbKeyY (89) - Y

VbKeyZ (90) - Z


[Numeric Key Constants]
vbKey0 (48) - D0

vbKey1 (49) - D1

vbKey2 (50) - D2

vbKey3 (51) - D3

vbKey4 (52) - D4

vbKey5 (53) - D5

vbKey6 (54) - D6

vbKey7 (55) - D7

vbKey8 (56) - D8

vbKey9 (57) - D9


[Numeric Keypad Key Constants]
vbKeyNumpad0 (96) - NumPad0

vbKeyNumpad1 (97) - NumPad1

vbKeyNumpad2 (98) - NumPad2

vbKeyNumpad3 (99) - NumPad3

vbKeyNumpad4 (100) - NumPad4

vbKeyNumpad5 (101) - NumPad5

vbKeyNumpad6 (102) - NumPad6

vbKeyNumpad7 (103) - NumPad7

vbKeyNumpad8 (104) - NumPad8

vbKeyNumpad9 (105) - NumPad9

VbKeyMultiply (106) - Multiply

VbKeyAdd (107) - Add

VbKeySeparator (108) - Separator

VbKeySubtract (109) - Subtract

VbKeyDecimal (110) - Decimal

VbKeyDivide (111) - Divide


[Function Key Constants]
vbKeyF1 (112) - F1

vbKeyF2 (113) - F2

vbKeyF3 (114) - F3

vbKeyF4 (115) - F4

vbKeyF5 (116) - F5

vbKeyF6 (117) - F6

vbKeyF7 (118) - F7

vbKeyF8 (119) - F8

vbKeyF9 (120) - F9

vbKeyF10 (121) - F10

vbKeyF11 (122) - F11

vbKeyF12 (123) - F12

vbKeyF13 (124) - F13

vbKeyF14 (125) - F14

vbKeyF15 (126) - F15

vbKeyF16 (127) - F16