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

1 comment:

Gabe Co Hadwin said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru Dot Net Training in Chennai. Nowadays Dot Net has tons of job opportunities on various vertical industry.
or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.