Thursday, 30 October 2014

C# WinForms - How to Select All Text in a Multiline Textbox

You can either override KeyUp or KeyDown for your TextBox. Simply use the following code...


Code Snippet
  1. private void TextBox_KeyUp(object sender, KeyEventArgs e)
  2. {
  3.     if (e.KeyData == (Keys.Control | Keys.A))
  4.         TextBox.SelectAll();
  5. }
End of Code Snippet

No comments: