Rajavel G

Rajavel G

  • NA
  • 95
  • 44.2k

C# code to count number of lines in textbox ?

Jul 6 2017 7:16 AM
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)