Reputation: 33
I have a csv file with 5 lines, each line has 2 values separated by a comma
554, 234
233, 123
237, 143
983, 239
349, 183
I want to read each line and put the first value in one array and the second value in another array
So far I have got
For Each line As String In System.IO.File.ReadAllLines("csv file")
.Add(line.Split(","))
Next
Upvotes: 1
Views: 631
Reputation: 19394
Dim lines() as String = System.IO.File.ReadAllLines("csv file")
Dim a1(lines.Length -1) As String
Dim a2(lines.Length -1) As String
For i As Integer = 0 To lines.Length - 1
Dim values() As String = lines(i).Split(",")
a1(i) = values(0).Trim()
a2(i) = values(1).Trim()
Next
Upvotes: 1