VB KeyCode Chart

Visual Basic Reference Add comments

This is a list I compiled which contains every possible KeyCode that Visual Basic can detect. A KeyCode is different than a KeyAscii value. A KeyCode can be thought of as an individual key on your keyboard. Every key on your keyboard has it's own unique KeyCode value. Keys that share values such as 1 and ! have the same KeyCode value because they are physically the same key. KeyCodes can range in value from 0 to 255. If you're looking for other charts, I also have a KeyAscii chart, a KeyCode Constants Chart and a downloadable program called KeyAscii & KeyCode Finder that can tell you the KeyAscii and KeyCode value for any character.

Download vb_keycode_chart.txt (June 24, 2004)

VB KeyCode Chart

0       No key pressed
1       The LEFT MOUSE Button
2       The RIGHT MOUSE Button
3       CANCEL KEY
4       The MIDDLE MOUSE Button (three-button mouse)
5       The first x mouse button (five-button mouse)
6       The second x mouse button (five-button mouse)
7       Undefined
8       BACKSPACE
9       TAB
10      The LINEFEED key
11      Undefined
12      CLEAR key
13      RETURN/ENTER KEY (next to letters) also ENTER KEY (on number-pad)
14      Undefined
15      Undefined
16      SHIFT
17      CTRL
18      ALT
19      PAUSE / BREAK
20      CAPS LOCK
21      The IME Hanguel mode key / The IME Kana mode key
22      Undefined
23      The IME Junja mode key
24      The IME final mode key
25      The IME Hanja mode key / The IME Kanji mode key
26      Undefined
27      ESC
28      The IME convert key
29      The IME nonconvert key
30      The IME accept key
31      The IME mode change key
32      SPACE BAR
33      PAGE UP / PGUP KEY
34      PAGE DOWN / PGDN KEY
35      END
36      HOME
37      LEFT ARROW KEY
38      UP ARROW KEY
39      RIGHT ARROW KEY
40      DOWN ARROW KEY
41      The SELECT key
42      The PRINT key
43      The EXECUTE key
44      The PRINT SCREEN key
45      INSERT
46      DELETE
47      The HELP key
48      0/) KEY ON KEYBOARD (above letters)
49      1/! KEY ON KEYBOARD (above letters)
50      2/@ KEY ON KEYBOARD (above letters)
51      3/# KEY ON KEYBOARD (above letters)
52      4/$ KEY ON KEYBOARD (above letters)
53      5/% KEY ON KEYBOARD (above letters)
54      6/^ KEY ON KEYBOARD (above letters)
55      7/& KEY ON KEYBOARD (above letters)
56      8/* KEY ON KEYBOARD (above letters)
57      9/( KEY ON KEYBOARD (above letters)
58      Undefined
59      Undefined
60      Undefined
61      Undefined
62      Undefined
63      Undefined
64      Undefined
65      A and a KEY
66      B and b KEY
67      C and c KEY
68      D and d KEY
69      E and e KEY
70      F and f KEY
71      G and g KEY
72      H and h KEY
73      I and i KEY
74      J and j KEY
75      K and k KEY
76      L and l KEY
77      M and m KEY
78      N and n KEY
79      O and o KEY
80      P and p KEY
81      Q and q KEY
82      R and r KEY
83      S and s KEY
84      T and t KEY
85      U and u KEY
86      V and v KEY
87      W and w KEY
88      X and x KEY
89      Y and y KEY
90      Z and z KEY
91      The left Windows logo key
92      The right Windows logo key
93      CONTEXT-MENU KEY (KEY WHICH SIMULATES A RIGHT-MOUSE CLICK)
94      Reserved
95      SLEEP/STANDBY KEY ON KEYBOARD
96      0 KEY (on number-pad)
97      1 KEY (on number-pad)
98      2 KEY (on number-pad)
99      3 KEY (on number-pad)
100     4 KEY (on number-pad)
101     5 KEY (on number-pad)
102     6 KEY (on number-pad)
103     7 KEY (on number-pad)
104     8 KEY (on number-pad)
105     9 KEY (on number-pad)
106     * KEY (on number-pad)
107     + KEY (on number-pad)
108     The separator key (ENTER key on number-pad)
109     - KEY (on number-pad)
110     . KEY (on number-pad)
111     / KEY (on number-pad)
112     F1
113     F2
114     F3
115     F4
116     F5
117     F6
118     F7
119     F8
120     F9
121     F10
122     F11
123     F12
124     F13
125     F14
126     F15
127     F16
128     F17
129     F18
130     F19
131     F20
132     F21
133     F22
134     F23
135     F24
136     Unassigned
137     Unassigned
138     Unassigned
139     Unassigned
140     Unassigned
141     Unassigned
142     Unassigned
143     Unassigned
144     NUM LOCK
145     SCROLL LOCK
146     OEM specific
147     OEM specific
148     OEM specific
149     OEM specific
150     OEM specific
151     Unassigned
152     Unassigned
153     Unassigned
154     Unassigned
155     Unassigned
156     Unassigned
157     Unassigned
158     Unassigned
159     Unassigned
160     The left SHIFT key
161     The right SHIFT key
162     The left CTRL key
163     The right CTRL key
164     The left ALT key
165     The right ALT key
166     BROWSER BACK KEY ON KEYBOARD / INTERNET-CONTROL (Windows 2000 or later)
167     BROWSER FORWARD KEY ON KEYBOARD / INTERNET-CONTROL (Windows 2000 or later)
168     BROWSER REFRESH KEY ON KEYBOARD / INTERNET-CONTROL (Windows 2000 or later)
169     BROWSER STOP KEY ON KEYBOARD / INTERNET-CONTROL (Windows 2000 or later)
170     BROWSER SEARCH KEY ON KEYBOARD / INTERNET-CONTROL (Windows 2000 or later)
171     BROWSER FAVORITES KEY ON KEYBOARD / INTERNET-CONTROL (Windows 2000 or later)
172     BROWSER HOME KEY ON KEYBOARD / INTERNET-CONTROL (Windows 2000 or later)
173     MUTE KEY ON KEYBOARD / MEDIA-CONTROL (Windows 2000 or later)
174     VOLUME DOWN KEY ON KEYBOARD / MEDIA-CONTROL (Windows 2000 or later)
175     VOLUME UP KEY ON KEYBOARD / MEDIA-CONTROL (Windows 2000 or later)
176     The media next track key (Windows 2000 or later)
177     The media previous track key (Windows 2000 or later)
178     The media Stop key (Windows 2000 or later)
179     The media play pause key (Windows 2000 or later)
180     The launch mail key / E-MAIL KEY ON KEYBOARD / INTERNET-CONTROL (Windows 2000 or later)
181     The select media key / MEDIA KEY ON KEYBOARD / MEDIA-CONTROL (Windows 2000 or later)
182     The start application one key (Windows 2000 or later)
183     The start application two key (Windows 2000 or later)
184     Reserved
185     Reserved
186     ; and : KEY
187     =/+ KEY ON KEYBOARD (above letters)
188     , and < KEY
189     -/_ KEY ON KEYBOARD (above letters)
190     . and > KEY
191     / and ? KEY
192     ~ and ` KEY ON KEYBOARD
193     Reserved
194     Reserved
195     Reserved
196     Reserved
197     Reserved
198     Reserved
199     Reserved
200     Reserved
201     Reserved
202     Reserved
203     Reserved
204     Reserved
205     Reserved
206     Reserved
207     Reserved
208     Reserved
209     Reserved
210     Reserved
211     Reserved
212     Reserved
213     Reserved
214     Reserved
215     Reserved
216     Unassigned
217     Unassigned
218     Unassigned
219     [ and { KEY
220      and | KEY
221     ] and } KEY
222     ' and " KEY
223     Used for miscellaneous characters; it can vary by keyboard
224     Reserved
225     OEM specific
226     The OEM angle bracket or backslash key on the RT 102 key keyboard (Windows 2000 or later)
227     OEM specific
228     OEM specific
229     The PROCESS KEY key (IME PROCESS KEY)
230     Oem specific
231     Used to pass Unicode characters as if they were keystrokes (Windows 2000 or later)
232     Unassigned
233     OEM specific
234     OEM specific
235     OEM specific
236     OEM specific
237     OEM specific
238     OEM specific
239     OEM specific
240     OEM specific
241     OEM specific
242     OEM specific
243     OEM specific
244     OEM specific
245     OEM specific
246     The ATTN key
247     The CRSEL key
248     The EXSEL key
249     The ERASE EOF key
250     The PLAY key
251     The ZOOM key
252     Reserved for future use
253     The PA1 key
254     The CLEAR key
255     OTHER / MISC KEY ON KEYBOARD

MSDN Links
 Explanation of The KeyDown and KeyUp Events (in Visual Basic 6)
 Explanation of The KeyPress Event (in Visual Basic 6)

One Response to “VB KeyCode Chart”

  1. I found your site on google, great site, keep it up. Will return in the future. Submitted this post to Google News Reader.

Leave a Comment

Entries RSS Comments RSS Log in