Control.IsKeyLocked Method (Keys)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Determines whether the CAPS LOCK, NUM LOCK, or SCROLL LOCK key is in effect.

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

static member IsKeyLocked : 
        keyVal:Keys -> bool

Parameters

keyVal
Type: System.Windows.Forms.Keys

The CAPS LOCK, NUM LOCK, or SCROLL LOCK member of the Keys enumeration.

Return Value

Type: System.Boolean

true if the specified key or keys are in effect; otherwise, false.

Exception Condition
NotSupportedException

The keyVal parameter refers to a key other than the CAPS LOCK, NUM LOCK, or SCROLL LOCK key.

Use the IsKeyLocked property to determine whether the CAPS LOCK, NUM LOCK, or SCROLL LOCK keys are on, whether individually or in combination.

The following code example displays a message box indicating whether the specified key (the Caps Lock key in this case) is in effect.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: