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

El siguiente ejemplo de código usa TextBox, 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 a la 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. Este ejemplo requiere que un TextBox se ha creado con nombre textBox1.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 le permite seleccionar todo el texto dentro del control.This method enables you to select all text within the control. Puede usar este método junto con el Cut método, que requiere tener texto seleccionado en el control, para todo el contenido del control de cortar y pegar 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