I've got a System.Windows.Forms.TextBox that is multi-line but it doesn't accept commands like Control-A and Control-Backspace.
Control-A does nothing and Control-Backspace inserts a box character.
The "Shortcuts Enabled" property is set to true.
That is, press the Ctrl key and hold it down, and press the Backspace key at the same time.
Ctrl+Backspace inserts a small box instead of erasing.
From MSDN on the ShortcutsEnabled property:
The TextBox control does not support the CTRL+A shortcut key when the Multiline property value is true.
You'll have to implement it yourself.
Something like this should work:
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control & e.KeyCode == Keys.A)
{
textBox1.SelectAll();
}
else if (e.Control & e.KeyCode == Keys.Back)
{
SendKeys.SendWait("^+{LEFT}{BACKSPACE}");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With