How to disable textbox from editing?

HelpNeeder picture HelpNeeder · Nov 30, 2011 · Viewed 166.2k times · Source

I want to use a text box to display some text. I can not disable it, because then the scroll bar will not work.

How can I prevent editing within the multi-line textbox, yet make it appear as if it is enabled, so that the scroll bar works correctly?

Answer

Austin Salonen picture Austin Salonen · Nov 30, 2011

You can set the ReadOnly property to true.

Quoth the link:

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.