Share via


HtmlEventArgs.KeyCode Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the integer Unicode value of a key that is associated with a keyboard event other than "keypress".

Namespace:  System.Windows.Browser
Assembly:  System.Windows.Browser (in System.Windows.Browser.dll)

Syntax

'Declaration
Public ReadOnly Property KeyCode As Integer
public int KeyCode { get; }

Property Value

Type: System.Int32
The integer Unicode value of a key involved in a keyboard event, if the event is not "keypress"; otherwise, 0 (zero).

Remarks

In Internet Explorer, this property also returns a nonzero value for "keypress" events.

In Firefox, the property may not always return a nonzero value for "keypress" events. Therefore, we recommend that you use the CharacterCode property instead.

The property returns 0 (zero) for non-keyboard events in all browsers.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.