Export (0) Print
Expand All

Keyboard Class

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

Provides properties for accessing the current state of the keyboard, such as what keys are currently pressed, and provides a method to send keystrokes to the active window.

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

public class Keyboard
public class Keyboard
public class Keyboard

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

The My.Computer.Keyboard object provides an interface to the computer's keyboard. The properties of the My.Computer.Keyboard provide information about the state of several special keys. The My.Computer.Keyboard.SendKeys method lets you send keys to the active window as if they have been typed at the keyboard.

This example uses the My.Computer.Keyboard.CtrlKeyDown property to determine if the computer's CTRL key is pressed.

If My.Computer.Keyboard.CtrlKeyDown Then
    MsgBox("CTRL key down")
Else
    MsgBox("CTRL key up")
End If

System.Object
  Microsoft.VisualBasic.Devices.Keyboard

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

Community Additions

ADD
Show:
© 2014 Microsoft