This documentation is archived and is not being maintained.

Keyboard.CapsLock Property

Note: This property is new in the .NET Framework version 2.0.

Gets a Boolean indicating if CAPS LOCK is turned on.

Namespace: Microsoft.VisualBasic.Devices
Assembly: Microsoft.VisualBasic (in microsoft.visualbasic.dll)

public bool CapsLock { get; }
/** @property */
public boolean get_CapsLock ()

public function get CapsLock () : boolean

Property Value

A Boolean value: True if CAPS LOCK is turned on; otherwise False.

For more detailed information, see the Visual Basic topic My.Computer.Keyboard.CapsLock Property.

Only the state of CAPS LOCK is returned.

This example uses the My.Computer.Keyboard.CapsLock property to determine if the computer's CAPS LOCK is turned on.

If My.Computer.Keyboard.CapsLock Then
    MsgBox("CAPS LOCK on")
    MsgBox("CAPS LOCK off")
End If

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0