I\'m asking the question already asked (and even answered) here: Why are some textboxes not accepting Control + A shortcut to select all by default
But that answer d
Like other answers indicate, Application.EnableVisualStyles()
should be called. Also the TextBox.ShortcutsEnabled
should be set to true
. But if your TextBox.Multiline
is enabled then Ctrl+A will not work (see MSDN documentation). Using RichTextBox
instead will get around the problem.
Quick answer is that if you are using multiline true you have to explicitly call the select all.
private void tbUsername_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.A && e.Control)
{
tbUsername.SelectAll();
}
}
Textbox has a method SelectAll()
and worked well for me. (.net 4.5)