Hello!! I have a text file with some lines in it. How can I know the number of lines in that file? thanks!
Dekel C.
Read it in, count the number of \n characters, add one.
You can't know the number of lines without reading them. The simplest way in .NET 2.0 is: Code: IO.File.ReadAllLines().Length If you actually want to keep the data then you'd assign the result of ReadAllLines to a String() variable and then use the Length property of that.
IO.File.ReadAllLines().Length
Why is my data not saved to my database? | MSDN Data Walkthroughs VBForums Database Development FAQ My CodeBank Submissions: VB | C# My Blog: Data Among Multiple Forms (3 parts) Beginner Tutorials: VB | C# | SQL
Forum Rules