This documentation is archived and is not being maintained.

Creating a Read-Only Text Box (Windows Forms)

Visual Studio .NET 2003

You can transform an editable Windows Forms text box into a read-only control. For example, the text box may display a value that is usually edited but may not be currently, due to the state of the application.

To create a read-only text box

  • Set the TextBox control's ReadOnly property to true. With the property set to true, users can still scroll and highlight text in a text box without allowing changes. A Copy command is functional in a text box, but Cut and Paste commands are not.
    Note   The ReadOnly property only affects user interaction at run time. You can still change text box contents programmatically at run time by changing the Text property of the text box.

See Also

Introduction to the Windows Forms TextBox Control | Controlling the Insertion Point in a Windows Forms TextBox Control | Creating a Password Text Box with the Windows Forms TextBox Control | Putting Quotation Marks in a String Programmatically (Windows Forms) | Selecting Text Programmatically in the Windows Forms TextBox Control | Viewing Multiple Lines in the Windows Forms TextBox Control | TextBox Class | TextBox Control (Windows Forms)