TextBoxBase.SelectAll 메서드

정의

텍스트 상자의 모든 텍스트를 선택합니다.

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

예제

다음 코드 예제에서는 파생 클래스를 사용하여 TextBox컨트롤에서 텍스트가 선택되어 있는지 확인합니다. 텍스트를 선택하지 않으면 컨트롤의 내용을 클립보드SelectAll 복사하기 전에 메서드를 호출합니다. 이 예제에서는 명명textBox1된 이름이 TextBox 필요합니다.

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

설명

이 메서드를 사용하면 컨트롤 내의 모든 텍스트를 선택할 수 있습니다. 컨트롤에서 텍스트를 선택해야 하는 메서드와 함께 Cut 이 메서드를 사용하여 컨트롤의 전체 내용을 잘라내어 클립보드 에 붙여넣을 수 있습니다.

적용 대상