Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable textbox from editing?

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?

like image 736
HelpNeeder Avatar asked Nov 30 '11 17:11

HelpNeeder


People also ask

How do I make a textbox non editable in VB net?

Use the ReadOnly property on the TextBox. 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.


2 Answers

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.

like image 194
Austin Salonen Avatar answered Sep 20 '22 12:09

Austin Salonen


The TextBox has a property called ReadOnly. If you set that property to true then the TextBox will still be able to scroll but the user wont be able to change the value.

like image 24
norlando Avatar answered Sep 19 '22 12:09

norlando