Keyboard Input in Visual C

From WLCS
Revision as of 13:15, 20 November 2009 by Admin (talk | contribs) (New page: # 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: <source lang="csharp"> this.KeyDo...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  1. Select the Form and go to its Properties
  2. Change the KeyPreview property to True
  3. 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);
}