Any ideas how to stop the system bell from sounding when CTRL-A is used to select text in a Winforms application?
Here\'s the problem. Create a
Thanks to an MSDN Forum post - this problem only occurs when textboxes are in multiline mode and you'd like to implement Ctrl+A for select all.
Here's the solution
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.A | Keys.Control)) {
txtContent.SelectionStart = 0;
txtContent.SelectionLength = txtContent.Text.Length;
txtContent.Focus();
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}