4
Answers

C# code to count number of lines in textbox ?

Rajavel G

Rajavel G

7y
525
1
C# code to count number of lines in text box ?
 
 string strtext = textbox1.text;
strtext = strtext.Replace('\r', '\n').Trim();
rslt = 0;
foreach (string s in strtext.Split('\n'))
rslt++;
txtline.Text = rslt.ToString();
 
 
I tried that above.. but wrap lines of text box is not included with in count??
Thanks in Advance
 
Answers (4)