TextBoxBase.SelectAll Yöntem

Tanım

Metin kutusundaki tüm metni seçer.

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

Örnekler

Aşağıdaki kod örneği, denetimde herhangi bir metnin seçili olup olmadığını belirlemek için türetilmiş bir sınıfı kullanır TextBox. Seçili metin yoksa, denetimin SelectAll içeriğini Pano'ya kopyalamadan önce yöntemine bir çağrı yapılır. Bu örnek, adlı TextBoxbir textBox1 oluşturulmasını gerektirir.

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

Açıklamalar

Bu yöntem, denetimdeki tüm metinleri seçmenizi sağlar. Denetimin içeriğinin Cut tamamını kesip Pano'ya yapıştırmak için bu yöntemi, denetimde metnin seçilmesini gerektiren yöntemiyle birlikte kullanabilirsiniz.

Şunlara uygulanır