This document is archived and information here might be outdated.  Recommended version.

IToolbarControlEvents.OnKeyDown Event (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > IToolbarControlEvents Interface > IToolbarControlEvents.OnKeyDown Event
ArcGIS Developer Help

IToolbarControlEvents.OnKeyDown Event

Fires after a key is pressed on the keyboard.

[Visual Basic .NET]
Public Event OnKeyDown As OnKeyDownEventHandler
public event OnKeyDownEventHandler OnKeyDown
  long keyCode,
  long shift
keyCode [in]

keyCode is a parameter of type long shift [in]
shift is a parameter of type long

Product Availability

Available with ArcGIS Engine.


The OnKeyDown event is triggered when the user presses a key whilst the ToolbarControl has focus.

keyCode specifies a virtual key code value of the key pressed on the keyboard. For alpha-numeric keys this corresponds to the ASCII value, for example "A" key returns 65 which is the ASCII value for capital A. Other key codes are F1 to F12 are 112 to 123 respectively.

Shift specifies an integer corresponding to the state of the SHIFT (bit 0), CTRL (bit 1) and ALT (bit 2) keys. When none, some or all of these keys are pressed none, some or all the bits get set. These bits correspond to the values 1, 2, and 4, respectively. For example, if both SHIFT and ALT were pressed, ShiftState would return 5.


Some development environments will filter out keystrokes. Typically the arrow keys are used to change control focus and will not fire the OnKeyDown event. To intercept these keys use the KeyIntercept property.

See Also

IToolbarControlEvents Interface