<< Click to Display Table of Contents >>
KeyPress |
KeyPress(KeyAscii)
This event occurs when an object receives keyboard focus and users press a key corresponding to a character that can be displayed on screen (an ANSI key, with its code indicated in the KeyAscii parameter), that is, this event occurs when any of the following keys are pressed:
•Any printable keyboard character
•The CTRL key combined with any standard alphabet character
•The CTRL key combined with any special character
•The BACKSPACE key
•The ESC key
This event does not occur in the following conditions:
•When pressing the TAB key
•When pressing the ENTER key
•When pressing the DEL key (this is not an ANSI key)
•When pressing keyboard arrow keys
•When a key changes focus from one object to another
While users are pressing a key that produces an ANSI code, an object repeatedly receives the KeyDown event and this event. When users release that key, the KeyUp event occurs. To monitor the physical status of a keyboard or to handle keys not recognized by this event (such as function keys, browsing keys, etc.), use the KeyDown and KeyUp events.
NOTE |
For a list with all key codes available for the KeyAscii parameter, please check the article Keys Enumeration on Microsoft Developer Network. |