Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual Basic
 How to: Determine If CapsLock is On
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:

Want more? Here are some additional resources on this topic:

Visual Basic Language Concepts 
How to: Determine If CapsLock is On in Visual Basic 

The My.Computer.Keyboard object can be used to determine the current state of the keyboard, including such things as whether NUM LOCK or CAPS LOCK is on.

To determine if CAPS LOCK is on

  • To determine whether or not CAPS LOCK is on, use the My.Computer.Keyboard.CapsLock property. The following code displays a message about the state of the CAPS LOCK.

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

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker