1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
   | Dim table As New DataTable()
Using reader As New StreamReader(cheminDuFichier)
 
    Dim header As String = reader.ReadLine()
    Dim columnNames As String() = header.Split(";")
    For Each columnName As String In columnNames
        table.Columns.Add(columnName, GetType(String))
    Next
 
    Dim line As String = reader.ReadLine()
    While line IsNot Nothing
 
        Dim fields As String() = line.Split(";")
        Dim row As DataRow = table.NewRow()
        For i As Integer = 0 To fields.Length - 1
            row(i) = fields(i)
        Next
 
        line = reader.ReadLine()
    End While
 
End Using | 
Partager