public int WordCount(RichTextBox rtb) { if (rtb.Text.Equals("")) { return 0; } else { string[] sWords = rtb.Text.Split(' '); int iWords = sWords.Length; return iWords; } } private void label1_Click(object sender, EventArgs e) { label1.Text = Convert.ToString(WordCount(rtbText)); } } }
rtbText
rtb.Text
rtb
private void richTextBox1_TextChanged(object sender, EventArgs e) { label1.Text = richTextBox1.Text.Length.ToString(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)