|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to get total number of lines in a text file
I am using this line to read a CSV file into myreader variables
Code:
myStream = openFileDialog1.OpenFile() Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser( myStream ) Then I read each row using this command Code:
CurrentRow = MyReader.ReadFields() I am trying to find a way to get the total number of lines in the CSV file so I can display a progressbar as I read each line |
|
#2
|
||||
|
||||
|
If all you need to do is count the lines, try something like this:
Code:
Dim sr As StreamReader = File.OpenText(myFileName)
Dim myCount as Integer = 0
'loop until the end
While Not (sr.ReadLine() Is Nothing)
myCount += 1
End While
sr.Close()
Zath |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > How to get total number of lines in a text file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|