TextBoxBase.SelectAll Methode

Definitie

Hiermee selecteert u alle tekst in het tekstvak.

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

Voorbeelden

In het volgende codevoorbeeld wordt een afgeleide klasse gebruikt TextBoxom te bepalen of er tekst in het besturingselement is geselecteerd. Als er geen tekst is geselecteerd, wordt er een aanroep naar de SelectAll methode uitgevoerd voordat u de inhoud van het besturingselement naar het Klembord kopieert. Voor dit voorbeeld is vereist dat er een TextBox naam textBox1is gemaakt.

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

Opmerkingen

Met deze methode kunt u alle tekst in het besturingselement selecteren. U kunt deze methode gebruiken in combinatie met de Cut methode, waarvoor tekst moet worden geselecteerd in het besturingselement, om de volledige inhoud van het besturingselement te knippen en in het Klembord te plakken.

Van toepassing op