TextBoxBase.TextLength プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TextBoxBase.TextLength プロパティの意味・解説 

TextBoxBase.TextLength プロパティ

コントロールテキスト長さ取得します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Overridable ReadOnly
 Property TextLength As Integer
Dim instance As TextBoxBase
Dim value As Integer

value = instance.TextLength
public virtual int TextLength { get;
 }
public:
virtual property int TextLength {
    int get ();
}
/** @property */
public int get_TextLength ()

プロパティ
コントロールテキスト格納されている文字数

解説解説
使用例使用例

AppendText メソッドTextLength プロパティ使用してTextBox 間でテキストコピーする方法次のコード例示します。この例では、textBox1 および textBox2 という名前の 2 つTextBox コントロールフォーム追加されており、textBox1Text プロパティテキスト割り当てられている必要があります

Private Sub AppendTextBox1Text()
   ' Determine if text is selected in textBox1.
   If textBox1.SelectionLength = 0 Then
      ' No selection made, return.
      Return
   End If
   ' Determine if the text being appended to textBox2 exceeds the MaxLength
 property.
   If textBox1.SelectedText.Length + textBox2.TextLength >
 textBox2.MaxLength Then
      MessageBox.Show("The text to paste in is larger than the
 maximum number of characters allowed")
      ' Append the text from textBox1 into textBox2.
   Else
      textBox2.AppendText(textBox1.SelectedText)
   End If
End Sub
private void AppendTextBox1Text()
{
   // Determine if text is selected in textBox1.
   if(textBox1.SelectionLength == 0)
      // No selection made, return.
      return;
   
   // Determine if the text being appended to textBox2 exceeds the MaxLength
 property.
   if((textBox1.SelectedText.Length + textBox2.TextLength) >
 textBox2.MaxLength)
      MessageBox.Show("The text to paste in is larger than
 the maximum number of characters allowed");
   else
      // Append the text from textBox1 into textBox2.
      textBox2.AppendText(textBox1.SelectedText);
}
void AppendTextBox1Text()
{
   // Determine if text is selected in textBox1.
   if ( textBox1->SelectionLength == 0 )

   // No selection made, return.
   return;

   // Determine if the text being appended to textBox2 exceeds the MaxLength
 property.
   if ( (textBox1->SelectedText->Length + textBox2->TextLength)
 > textBox2->MaxLength )
         MessageBox::Show( "The text to paste in is larger
 than the maximum number of characters allowed" ); // Append the
 text from textBox1 into textBox2.
   else
         textBox2->AppendText( textBox1->SelectedText );
}
private void AppendTextBox1Text()
{
    // Determine if text is selected in textBox1.
    if (textBox1.get_SelectionLength() == 0) {
        // No selection made, return.
        return;
    }
    // Determine if the text being appended to textBox2 exceeds the
 MaxLength
    // property.
    if (textBox1.get_SelectedText().get_Length()
        + textBox2.get_TextLength() > textBox2.get_MaxLength()) {
        MessageBox.Show("The text to paste in is larger than
 the maximum"
            + " number of characters allowed");
    }        
    else {
        // Append the text from textBox1 into textBox2.
        textBox2.AppendText(textBox1.get_SelectedText());
    }        
} //AppendTextBox1Text
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からTextBoxBase.TextLength プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からTextBoxBase.TextLength プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からTextBoxBase.TextLength プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「TextBoxBase.TextLength プロパティ」の関連用語

TextBoxBase.TextLength プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



TextBoxBase.TextLength プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS