textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I HAVE A MULTILINE TEXTBOX THAT HAS A CONTROL BESIDE IT. THE CONTROL BESIDE
IT SHOULD SAY SOMETHING LIKE "145 CHARACTERS LEFT". THIS TELLS THE USER WHEN
HE'LL REACH THE MAX CHAR. ALLOWED. AS THE USER TYPES INSIDE THE TEXTBOX, THE
CONTROL BESIDE IT WILL CONTINUE COUNTING DOWN. AN EXAMPLE OF THIS IS CARFAX'S
VIN# TEXTBOX. HOW DO I IMPLEMENT THIS? THANKS IN ADVANCE.
 
Newbie said:
I HAVE A MULTILINE TEXTBOX THAT HAS A CONTROL BESIDE IT. THE CONTROL BESIDE
IT SHOULD SAY SOMETHING LIKE "145 CHARACTERS LEFT". THIS TELLS THE USER
WHEN
HE'LL REACH THE MAX CHAR. ALLOWED. AS THE USER TYPES INSIDE THE TEXTBOX,
THE
CONTROL BESIDE IT WILL CONTINUE COUNTING DOWN.

Hi. Set the MaxLength property of the textbox to have the maximum number of
chars that you will allow. Then add the TextChanged event to the textbox
and in the handler for it show the remaining left. For example,
lblRemaining.Text = (txtBox.MaxChars - txtBox.Text.Length).ToString();

PS Please don't type in caps, it is used to signify shouting. Thx.

-- Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top