Skip to content

KeyDown Event

Description

Occurs when the user presses a key while a control has the focus. (To determine ANSI characters, use the KeyPress event.)

Syntax

Public Event KeyDown( _
    ByRef KeyCode As Integer, _
    ByVal Shift As Integer _
)

Parameters

  • KeyCode: A key code, such as vbKeyF1 (the F1 key) or vbKeyHome (the HOME key).
  • Shift: Specifies whether the Shift, Ctrl, or ALT keys were pressed.

Remarks

The control with focus receives all keystrokes, and this event is most commonly used for:

  • Extended character keys
  • Navigation keys
  • Combinations of keys with standard keyboard modifiers
  • Distinguishing between the numeric keypad and regular number keys

This event is not invoked for the TAB key.

To determine between uppercase and lowercase, you must look at both the KeyCode and Shift arguments.

See Also


See Also


Command Bars ActiveX Control v24.0


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.