This documentation is archived and is not being maintained.

TextBoxBase.ReadOnly Property

Gets or sets a value indicating whether text in the text box is read-only.

[Visual Basic]
Public Property ReadOnly As Boolean
[C#]
public bool ReadOnly {get; set;}
[C++]
public: __property bool get_ReadOnly();
public: __property void set_ReadOnly(bool);
[JScript]
public function get ReadOnly() : Boolean;
public function set ReadOnly(Boolean);

Property Value

true if the text box is read-only; otherwise, false. The default is false.

Remarks

When this property is set to true, the contents of the control cannot be changed by the user at runtime. With this property set to true, you can still set the value of the Text property in code. You can use this feature instead of disabling the control with the Enabled property to allow the contents to be copied.

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

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

Show: