If the files that will be read are not extra large files and are delimited by CRLF, you can use the
ReadAllText
method to read the entire file into a string and
Strings.Split
to create an array of Type String where each element of the array is a row of the file.
Dim arrFileContents() As String = Strings.Split( _
My.Computer.FileSystem.ReadAllText( _
"C:\bat\RestoreSQL.log"), vbCrLf)
Dim intMaxIndex as Integer = arrFileContents.GetUpperBound(0) ' The highest index of the array
Dim intFileRows as Integer = arrFileContents.GetUpperBound(0) + 1 ' The number of rows in the file