I'm about to implement a UserControl that has several other controls inside.
As soon as a control inside the my containing UserControl I want to react on keystrokes (like Ctrl+A to select all controls inside). How can this be accomplished
Thanks in advance!

Re: Windows Forms General Capture keystrokes inside a UserControl


Override the ProcessCmdKey() method:

public partial class UserControl1 : UserControl {
public UserControl1() {
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
if (keyData == (Keys.A | Keys.Control)) {
// Do your stuff...
return true; // Don't pass to focused control
return base.ProcessCmdKey(ref msg, keyData);

Note that it will only run when one of the controls in the UserControl has the focus.