The first line of defense against user error is to catch problems as the user
presses each key. The following sections discuss how to use three Keystroke events
to intercept, interpret, and modify each keystroke.
You can validate keyboard input on two different levels in VB:
You write validation code in the Keystroke events of each separate control.
The validation code in a control's Keystroke event runs when that control has
focus and the user presses keys on the keyboard.
The form also has the same Keystroke events that can intercept all keyboard
input while that form is the application's active form. When form-level key handling
is active, the form's Keystroke events receive the keystroke before the currentlyactive
control's Keystroke events receive it. By default, form-level Keystroke handling
is not enabled. We discuss how to implement form-level Keystroke handling in the
section "Enabling Two-Tier Validation With the Form's Keypreview Property."
Following topics are covered in this topic