if (txtmessage.Text.Length > 0) { txtcount.Text = txtmessage.Text.Length.ToString(); } else txtcount.Text = Convert.ToString(0);
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace counttextusingevent{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void txtmessage_TextChanged(object sender, EventArgs e) { if (txtmessage.Text.Length > 0) { txtcount.Text = txtmessage.Text.Length.ToString(); } else txtcount.Text = Convert.ToString(0); } }}