Detecting Key Presses

WinForms

Use the following code to detect a key press when focus is on a particular object.

Note: There is different syntax for WPF.

WPF

Non-Binding Method

Use the following code to detect a key press when focus is on a particular object.

Note: There is different syntax for WinForms.