Is there a way to start a method in C# if a key is pressed? For example, Esc?
First in Properties do > KeyPreview : True
Then :
private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { //call your method here } }