I just wanted to know how to display the remaining characters in my textbox, just in case the user input exceeded the character limit.
For example, here is my textbox:
Enter Name: _____________ 50 Characters remaining
And when the user input is already 50 characters, he/she won't be able to type anything in that textbox anymore. Is that possible? Any help would be appreciated. Thanks in advance.
First you set the MaxLength property of the textbox to 50.
Then you need to subscribe to the TextChanged
event of the textbox to be notified when the text of the box has changed, and calulate the remaining characters by subtracting textBox.MaxLength
by textBox.TextLength