TextBoxBase.SelectAll TextBoxBase.SelectAll TextBoxBase.SelectAll TextBoxBase.SelectAll Method

Definición

Selecciona todo el texto del cuadro de texto.Selects all text in the text box.

public:
 void SelectAll();
public void SelectAll ();
member this.SelectAll : unit -> unit
Public Sub SelectAll ()

Ejemplos

En el ejemplo de código TextBoxsiguiente se usa, una clase derivada, para determinar si hay texto seleccionado en el control.The following code example uses TextBox, a derived class, to determine if any text is selected in the control. Si no hay texto seleccionado, se realiza una llamada al SelectAll método antes de copiar el contenido del control en el portapapeles.If no text is selected, a call is made to the SelectAll method before copying the contents of the control to the Clipboard. En este ejemplo se requiere TextBox que se haya creado textBox1un denominado.This example requires that a TextBox has been created named textBox1.

public:
   void CopyAllMyText()
   {
      // Determine if any text is selected in the TextBox control.
      if ( textBox1->SelectionLength == 0 )
      {
         // Select all text in the text box.
         textBox1->SelectAll();
      }

      // Copy the contents of the control to the Clipboard.
      textBox1->Copy();
   }
public void CopyAllMyText()
 {
    // Determine if any text is selected in the TextBox control.
    if(textBox1.SelectionLength == 0)
       // Select all text in the text box.
       textBox1.SelectAll();
    
    // Copy the contents of the control to the Clipboard.
    textBox1.Copy();
 }

Public Sub CopyAllMyText()
    ' Determine if any text is selected in the TextBox control.
    If textBox1.SelectionLength = 0 Then
        ' Select all text in the text box.
        textBox1.SelectAll()
    End If 
    ' Copy the contents of the control to the Clipboard.
    textBox1.Copy()
End Sub

Comentarios

Este método permite seleccionar todo el texto del control.This method enables you to select all text within the control. Puede utilizar este método junto con el Cut método, que requiere que se seleccione texto en el control para cortar todo el contenido del control y pegarlo en el portapapeles.You can use this method in conjunction with the Cut method, which requires text to be selected in the control, to cut the entire contents of the control and paste them into the Clipboard.

Se aplica a