Search code examples
c#methodskey

Press Escape key to call method


Is there a way to start a method in C# if a key is pressed? For example, Esc?


Solution

  • I am writing WinForms application. User fills the textbox and if he wants to delete everything, he just clicks esc key on keyboard

    I think you need to handle the KeyDown event.