I have a textbox (multiline) which has initial value, now when user tries to append values to it, he should not be able to modify the initial value. Is it possible in any way.
-Anil
I have a textbox (multiline) which has initial value, now when user tries to append values to it, he should not be able to modify the initial value. Is it possible in any way.
-Anil
You could use RichTextBox
SelectionProtected
property.So if you have "lorem ipsum" in the box you want the user to be able to add to but not remove that text? If so then with a RichTextBox you can do this via a selection's
.SelectionProtected
property which will mark a region as effectively being read only.Another option is to use a Masked Textbox. This way, you can have multiple protected areas if you wish.
For example, you would set the mask to:
Which would appear as:
Enter as many "C"'s as characters that you would like the user to be able to enter. You can also change the prompt character to a space rather than an "_" if you prefer.
For convenience...
Here is a list and description of masking characters
(taken from http://www.c-sharpcorner.com/uploadfile/mahesh/maskedtextbox-in-C-Sharp/).
All other characters - Literals. All non-mask elements will appear as themselves within MaskedTextBox. Literals always occupy a static position in the mask at run time, and cannot be moved or deleted by the user.