Click here to Skip to main content
15,997,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Group members,

I have done task to count number of words in multiline text-box using text change event for multiline text-box below is the code .But for each word I need to add value 10 for temporary variable.My problem is if I type 5 words and I am getting correct words ,But unable to add 10 for variable for each word.Can any help me to solve this problem
C#
char[] holdchars = { ' ', '\r', '\n' };
          string[] strs = txtstory.Text.Split(holdchars, StringSplitOptions.RemoveEmptyEntries);
          txttotalwords.Text = strs.Length.ToString();
Posted
Updated 6-Jan-12 1:00am
v3

1 solution

is this what u want?
char[] holdchars = { ' ', '\r', '\n' };
string[] strs = txtstory.Text.Split(holdchars,StringSplitOptions.RemoveEmptyEntries);
//txttotalwords.Text = strs.Length.ToString();
int intValue = (strs.Count())*10;
txttotalwords.Text = intValue.ToString();
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900