Selects all text in the text box.
[Visual Basic] Public Sub SelectAll() [C#] public void SelectAll(); [C++] public: void SelectAll(); [JScript] public function SelectAll();
The following example uses TextBox, a derived class, to determine if any text is selected in the control. If no text is selected, a call is made to the SelectAll method before copying the contents of the control to the Clipboard. This example assumes that a TextBox has been created named Text1.
[Visual Basic]
Public Sub CopyAllText() ' Determine if any text is selected in the TextBox control. If Not Text1.SelectionLength > 0 Then ' Select all text in the text box. Text1.SelectAll End If ' Copy the contents of the control to the Clipboard Text1.Copy End Sub
TextBoxBase Class | TextBoxBase Members | System.WinForms Namespace