My.Computer.Keyboard Property

Gets an object that 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.

' Usage
Dim value As Microsoft.VisualBasic.Devices.Keyboard = My.Computer.Keyboard
' Declaration
Public ReadOnly Property Keyboard As Microsoft.VisualBasic.Devices.Keyboard

Property Value

This property returns the My.Computer.Keyboard object for the computer.

Remarks

This property provides easy access to the My.Computer.Keyboard object. For more information, see My.Computer.Keyboard Object.

Example

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

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

Requirements

Namespace:Microsoft.VisualBasic.Devices

Class:Computer

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

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

Permissions

No permissions are required.

See Also

Reference

My.Computer Object

My.Computer.Keyboard Object