Search code examples
arraysvb.netcsvstringreader

How to Read All But the Header Row of a .CSV File?


I need to read a .csv file into an array but I don't want the first row of the .csv file to be in the array. How do I exclude it?

'Create array.
        Dim sReader As New StringReader(strBuffer)
        Dim List As New List(Of String)
    Do While sReader.Peek >= 0
        List.Add(sReader.ReadLine)
    Loop
        Dim lines As String() = List.ToArray
        sReader.Close()

Solution

  • Could you just remove the first element in the list?

    List.RemoveAt(0);