Count number of characters in textbox

To count the total number of characters in a textbox, call the TextChanged event of textbox. Check the code snippet below:


private void textBox1_TextChanged(object sender, EventArgs e)
{
lblCount.Text = "Total characters are: " + textBox1.Text.Length;
}


Comments

Guest Author: Shreeni01 Apr 2012

thank u..it was helpful

Guest Author: nethmi12 Jun 2012

This is really helpful..



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: