Keyboard.GetState Method

Returns the current keyboard state.

Namespace: Microsoft.Xna.Framework.Input
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public static KeyboardState GetState ()

Return Value

The current keyboard state.

Exceptions

Exception type Condition
InvalidOperationException An invalid operation occurred when querying the keyboard state.

See Also

Tasks

How to: Detect Whether a Key Is Pressed

Concepts

Input Overview

Reference

Keyboard Class
Keyboard Members
Microsoft.Xna.Framework.Input Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista