You are right!!! Just put a counter inside the while loop reading .csv file row by row i.e.
Dim ir As Integer = 0
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(fn)
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(",")
Dim currentRow As String()
Try
currentRow = MyReader.ReadFields()
ir = ir + 1
Catch ex As Microsoft.VisualBasic.
FileIO.MalformedLineException
MsgBox("Line " & ex.Message &
"is not valid and will be skipped.")
End Try
End While
End Using
0 Comments