|
The KeyDown event is generated when a key is pressed.
Syntax
Sub object_KeyDown( [Index As
Integer], KeyCode As Integer, Shift As
Integer )
Remarks
The KeyDown event is generated when the user presses a key
on the keyboard. The following arguments are passed to the event
handler:
- KeyCode
- A key code which identifies the key being pressed. If the key
is a number or letter on the keyboard, then the code corresponds to
its ASCII equivalent. For example, the key code for the 'A' key is
65. It is important to note that shift states are handled
differently in that the key code is the same regardless if the
shift or control key is being pressed at the same time. For keys
other than numbers or letters, consult the Virtual Key Constants table.
- Shift
- An integer that corresponds to the state of the Shift, Ctrl,
and Alt keys at the time the key is pressed. 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 keys are pressed, the value of
Shift is 6.
See Also
KeyMapped Event,
KeyPress Event, KeyUp
Event
|
|