TextBoxBase.Text プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

[LocalizableAttribute(true)] public: virtual property String^ Text { String^ get () override; void set (String^ value) override; }
コントロール内に表示するテキスト。

テキスト ボックスに複数行のテキストを表示するには、Multiline プロパティを true に設定します。複数行テキスト ボックスのテキストの読み取り、または設定には、Lines プロパティを使用します。RichTextBox コントロールに入力できるテキストの文字数が制限されるのは、使用可能なシステム メモリでだけです。
Windows 98, Windows Millennium Edition プラットフォームメモ : Text プロパティに格納できるテキストの文字数は、TextBox コントロールの場合 65 KB のメモリに制限されます。
Windows NT 4.0, Windows 2000, Windows 2000 Professional, Windows 2000 Server, Windows 2000 Advanced Server, Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003 プラットフォームメモ : Text プロパティに格納できるテキストの文字数は、利用できるシステム メモリの容量に制限されます。

派生クラス TextBox を使用して、垂直スクロール バーのある複数行 TextBox コントロールを作成するコード例を次に示します。この例では、AcceptsTab、AcceptsReturn、WordWrap の各プロパティも使用して、テキスト ドキュメントを作成しやすいように複数行テキスト ボックス コントロールを設定します。
Public Sub CreateMyMultilineTextBox() ' Create an instance of a TextBox control. Dim textBox1 As New TextBox() ' Set the Multiline property to true. textBox1.Multiline = True ' Add vertical scroll bars to the TextBox control. textBox1.ScrollBars = ScrollBars.Vertical ' Allow the RETURN key in the TextBox control. textBox1.AcceptsReturn = True ' Allow the TAB key to be entered in the TextBox control. textBox1.AcceptsTab = True ' Set WordWrap to true to allow text to wrap to the next line. textBox1.WordWrap = True ' Set the default text of the control. textBox1.Text = "Welcome!" & Environment.NewLine & "Second Line" End Sub
public void CreateMyMultilineTextBox() { // Create an instance of a TextBox control. TextBox textBox1 = new TextBox(); // Set the Multiline property to true. textBox1.Multiline = true; // Add vertical scroll bars to the TextBox control. textBox1.ScrollBars = ScrollBars.Vertical; // Allow the RETURN key in the TextBox control. textBox1.AcceptsReturn = true; // Allow the TAB key to be entered in the TextBox control. textBox1.AcceptsTab = true; // Set WordWrap to true to allow text to wrap to the next line. textBox1.WordWrap = true; // Set the default text of the control. textBox1.Text = "Welcome!" + Environment.NewLine + "Second Line"; }
public: void CreateMyMultilineTextBox() { // Create an instance of a TextBox control. TextBox^ textBox1 = gcnew TextBox; // Set the Multiline property to true. textBox1->Multiline = true; // Add vertical scroll bars to the TextBox control. textBox1->ScrollBars = ScrollBars::Vertical; // Allow the RETURN key in the TextBox control. textBox1->AcceptsReturn = true; // Allow the TAB key to be entered in the TextBox control. textBox1->AcceptsTab = true; // Set WordWrap to true to allow text to wrap to the next line. textBox1->WordWrap = true; // Set the default text of the control. textBox1->Text = "Welcome!" + Environment::NewLine + "Second Line"; }
public void CreateMyMultilineTextBox() { // Create an instance of a TextBox control. TextBox textBox1 = new TextBox(); // Set the Multiline property to true. textBox1.set_Multiline(true); // Add vertical scroll bars to the TextBox control. textBox1.set_ScrollBars(ScrollBars.Vertical); // Allow the RETURN key in the TextBox control. textBox1.set_AcceptsReturn(true); // Allow the TAB key to be entered in the TextBox control. textBox1.set_AcceptsTab(true); // Set WordWrap to true to allow text to wrap to the next line. textBox1.set_WordWrap(true); // Set the default text of the control. textBox1.set_Text("Welcome!" + Environment.get_NewLine() + "Second Line"); } //CreateMyMultilineTextBox

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.Text プロパティを検索する場合は、下記のリンクをクリックしてください。

- TextBoxBase.Text プロパティのページへのリンク