TextBoxBase.SelectAll メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


このメソッドを使用すると、コントロール内のすべてのテキストを選択できるようになります。このメソッドを、コントロール内でテキストを選択する必要のある Cut メソッドと共に使用すると、コントロールの内容全体を切り取り、クリップボードに貼り付けることができます。

派生クラス TextBox を使用して、コントロールでテキストが選択されているかどうかを判断するコード例を次に示します。テキストが選択されていない場合は、コントロールの内容をクリップボードにコピーする前に SelectAll メソッドが呼び出されます。この例では、textBox1 という名前の TextBox が作成されている必要があります。
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
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(); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からTextBoxBase.SelectAll メソッドを検索する場合は、下記のリンクをクリックしてください。

- TextBoxBase.SelectAll メソッドのページへのリンク