Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
KeyData Property

KeyEventArgs.KeyData Property

Gets the key data for a KeyDown or KeyUp event.

[Visual Basic]
Public ReadOnly Property KeyData As Keys
public Keys KeyData {get;}
public: __property Keys get_KeyData();
public function get KeyData() : Keys;

Property Value

A Keys value representing the key code for the key that was pressed, combined with modifier flags that indicate which combination of CTRL, SHIFT, and ALT keys were pressed at the same time.


You can use constants from Keys to extract information from the KeyData property. Use the bitwise AND operator to compare data returned by KeyData with constants in Keys to obtain information about which keys the user pressed. To determine whether a specific modifier key was pressed, use the Control, Shift, and Alt properties.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

KeyEventArgs Class | KeyEventArgs Members | System.Windows.Forms Namespace | KeyCode | KeyValue

© 2015 Microsoft