Export (0) Print
Expand All
Expand Minimize

Control.Text Property

Gets or sets the text associated with this control.

[Visual Basic]
Public Overridable Property Text As String
[C#]
public virtual string Text {get; 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);

Property Value

The text associated with this control.

Remarks

The Text property of the control is used differently by each derived class. For example the Text property of a Form is displayed in the title bar at the top of the form, is fairly small in character count, and usually displays the application or document name. However, the Text property of a RichTextBox can be large and can include numerous nonvisual characters used to format the text. For example, the text displayed in a RichTextBox can be formatted by adjusting the Font properties, or by the addition of spaces or tab characters to align the text.

Notes to Inheritors:  When overriding the Text property in a derived class, use the base class's Text property to extend the base implementation. Otherwise, you must provide all the implementation. You are not required to override both the get and set accessors of the Text property; you can override only one if needed.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

Control Class | Control Members | System.Windows.Forms Namespace | TextBoxBase.TextLength

Show:
© 2014 Microsoft