Keyboard Class
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.
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
The Keyboard type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | AltKeyDown | Gets a Boolean indicating if the ALT key is down. |
![]() | CapsLock | Gets a Boolean indicating if CAPS LOCK is turned on. |
![]() | CtrlKeyDown | Gets a Boolean indicating if a CTRL key is down. |
![]() | NumLock | Gets a Boolean indicating if the NUM LOCK key is on. |
![]() | ScrollLock | Gets a Boolean indicating whether the SCROLL LOCK key is on. |
![]() | ShiftKeyDown | Gets a Boolean indicating if a SHIFT key is down. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | SendKeys(String) | Sends one or more keystrokes to the active window, as if typed on the keyboard. |
![]() | SendKeys(String, Boolean) | Sends one or more keystrokes to the active window, as if typed on the keyboard. |
![]() | ToString | Returns a string that represents the current object. (Inherited from 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.
Tasks
The following table lists examples of tasks involving the My.Computer.Keyboard object.
To | See |
Check if CAPS LOCK is on | |
Send keystrokes to an application | How to: Start an Application and Send it Keystrokes (Visual Basic) |
Availability by Project Type
Project type | Available |
Windows Application | Yes |
Class Library | Yes |
Console Application | Yes |
Windows Control Library | Yes |
Web Control Library | No |
Windows Service | Yes |
Web Site | No |
Note |
|---|
The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: Resources. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes. |
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
