hi,
Try this also i think you want to count words in the whole string...
int count = 0;
string st = "this is your string including spaces and we are counting spaces count plus one is your words in the sentance ";
foreach (char c in st.Trim())
{
if (char.IsSeparator(c))
{
count++;
}
}
int totWords = count + 1;
lblResult.Text = count.ToString();
i know it will helps you 100%
Thank you.