Count textbox character and limit characters to 100

Satyapriyanayak
Posted by Satyapriyanayak under C# category on | Points: 40 | Views : 1188
We will know how to Count textbox character and limit characters to 100. 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Count_textbox_values
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

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

Comments or Responses

Login to post response