Object Reference > True DBGrid Events > KeyDown Event |
KeyDown Event
The KeyDown event occurs when the user presses a key.
object_KeyDown (KeyCode As Integer, Shift As Integer)
Arguments
KeyCode is an integer or constant representing a Windows key code. For example, the Visual Basic object library provides the constants vbKeyF1 (the F1 key) and vbKeyHome (the Home key).
Shift is an integer that corresponds to the state of the Shift, Ctrl, and Alt keys at the time of the event. The Shift argument is a bit field with the least-significant bits corresponding to the Shift key (bit 0), the Ctrl key (bit 1), and the Alt key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed. For example, if both Ctrl and Alt are pressed, the value of Shift is 6.
The KeyDown event occurs when the user presses a key. Although this event is fired for most keystrokes, it is most often used for:
· Extended character keys such as function keys.
· Navigation keys.
· Combinations of keys with standard keyboard modifiers.
· Distinguishing between the numeric keypad and regular number keys.