private void Form1_Load(object sender, EventArgs e) { this.KeyPreview = true; this.KeyDown += new KeyEventHandler(Form1_KeyDown); } void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode.ToString() == "F1") { // the user pressed the F1 key } }
KeyPress
F1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)