ReadOnly Property

TextBoxBase.ReadOnly Property

 

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

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public bool ReadOnly { get; set; }

Property Value

Type: System.Boolean

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

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 and ToolTips to be shown.

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft