How to select all text in a Windows Forms textbox?

How do I allow selection of everything in my multiline textbox?

It seems strange to me that there would be no way to do this; there should be something framed out of the box.

+2


source to share


3 answers


In case of Windows Forms :



textbox.SelectAll();

      

+9


source


Try the SelectAll method (actually located on the TextBoxBase).



TextBoxBase b = GetTheTextBox();
b.SelectAll();

      

+1


source


How about textbox1.SelectAll()

?

You can also use

textbox1..Select(0, textbox1.Text.Length);

      

and return the HideSelection property to False .

0


source







All Articles