How can i run a method when someone used a keyboard shortcut like Ctrl+G ?
The application is a Windows forms application and i only want to capture it when the form is activated.
How can i run a method when someone used a keyboard shortcut like Ctrl+G ?
The application is a Windows forms application and i only want to capture it when the form is activated.
Look at your OnKeyPress method on the Form or the KeyPress event for the Form.
Override the OnKeyPress like this...
protected override void OnKeyPress(KeyPressEventArgs e) { ... }
... and look at the KeyPressEventArgs to see what key was pressed and whether it was pressed with Ctrl.
This SO answer shows how to use the KeyPress event... Test for 'Ctrl' keydown in C#