The current text in the text box.
[Visual Basic] Overridable Public Property Text As String [C#] public string Text {override get; override set;} [C++] public: __property virtual String* get_Text(); public: __property virtual void set_Text(String*); [JScript] public function get Text() : String; public function set Text(String);
To display multiple lines of text in a text box, set the Multiline property to true. To read or set the text of a multiline text box, use the Lines property. The amount of text that can be stored in the Text property is limited to 65KB of memory for the TextBox control. The amount of text that can be entered in the RichTextBox control is limited only by available system memory.
The following example TextBox, a derived class, to create a multiline TextBox control with vertical scroll bars. This example also uses the AcceptsTab, AcceptsReturn, and WordWrap properties to make the multiline text box control useful for creating text documents.
[Visual Basic]
Public Sub CreateMultilineTextBox() ' Create an instance of a TextBox control Dim Text1 as TextBox Set Text1 = New TextBox() ' Set the Multiline property to True. Text1.Multiline = True ' Add vertical scroll bars to the TextBox control. Text1.Scrollbars = ScrollBars.Vertical ' Allow the RETURN key in the TextBox control. Text1.AcceptsReturn = True ' Allow the TAB key to be entered in the TextBox control. Text1.AcceptsTab = True ' Set WordWrap to True to allow text to wrap to the next line. Text1.WordWrap = True ' Set the default text of the control. Text1.Text = "Welcome!" End Sub
TextBoxBase Class | TextBoxBase Members | System.WinForms Namespace | Lines | Multiline