0

I have files that may contain up to 40,000,000 lines of data (records) in text files.

I need a memory efficient way to count how many lines are in a file.

I have tried:

Dim this As Integer
this = File.ReadAllLines(txtInPath.Text).Length
MsgBox(this)

where txtInPath is a text box in my form.

This code causes out of memory exception.

Thanks

McKee118
  • 9
  • 5
  • You might want to see [this answer](http://stackoverflow.com/q/119559), particularly the "belated" addition. – Ken White Jul 08 '14 at 14:46
  • That's exactly what worked! Thanks! – McKee118 Jul 08 '14 at 15:16
  • possible duplicate of [Determine the number of lines within a text file](http://stackoverflow.com/questions/119559/determine-the-number-of-lines-within-a-text-file) – Ken White Jul 08 '14 at 15:36

0 Answers0