|
<< Click to Display Table of Contents >>
KeyPress |
KeyPress(KeyAscii)
This event occurs when this object has the keyboard focus and users press a key, which corresponds to a character that can be displayed on screen, such as an ANSI key, with a code indicated by the KeyAscii parameter. This event occurs when any of the following keys is pressed:
•Any keyboard character that can be printed
•The CTRL key combined with any standard alphabet character
•The CTRL key combined with any special character
•The BACKSPACE key
•The ESC key
•The ENTER key
This event does not occur in the following conditions:
•By pressing the TAB key
•By pressing the DEL key, which is not a standard ANSI key
•By pressing the arrow keys
•By pressing a key that moves focus from one object to another
•By pressing the keys from 0 (zero) to 9 (nine) and the decimal point of the numeric keypad when the NUM LOCK key is deactivated
While users press a key that produces an ANSI code, this object receives this event and the KeyDown event repeatedly. When users release that key, the KeyUp event occurs. To monitor keyboard's physical status or to handle keys not recognized by this event, such as function or browsing keys, use the KeyDown and KeyUp events.
NOTE |
For a list with all key codes available for the KeyAscii parameter, please check the article Keys Enum on Microsoft Learn. |