Click here to Skip to main content
15,914,943 members
Please Sign up or sign in to vote.
1.40/5 (3 votes)
See more:
suppose i take a note pad..and place 10,000 numbers vertically one after the other...
now how will i get the number of lines(rows) in the notepad using c#..plz give some code thanks in advance
Posted
Comments
Sergey Alexandrovich Kryukov 27-Feb-13 2:16am    
You cannot, because Notepad is a very bad Microsoft application; and you don't have its source code. And it is not written in C#. The question makes no sense.
—SA
madaya123 4-Nov-14 22:38pm    
He's saying directly to the application meaning it's the .txt file to what he's referring to. He's asking for the codes on how to count the lines in the .txt file.

1 solution

hi,,


try this code,
u can get no.of lines in notepad.


C#
string[] lines = System.IO.File.ReadAllLines("D:\\12.txt");
MessageBox.Show(lines.Length.ToString());



regards,
Prakash.T
 
Share this answer
 
Comments
luckycode 27-Feb-13 2:29am    
ya..thsi works...and solved my problem..thank you

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