Keyboard Input in Visual C
From WLCS
- Select the Form and go to its Properties
- Change the KeyPreview property to True
- Add the following line of code to the public Form1() section:
this.KeyDown += new KeyEventHandler(Form1_KeyDown);
so it should look something like this:
public Form1()
{
InitializeComponent();
this.KeyDown += new KeyEventHandler(Form1_KeyDown);
}