Agent67
Honorary Master
I need some help here with the last bit of my final assignment please... So we're meant to put the contents of a 2D Array (taken from a text file) inside of a DataGridView. Now I could narrow down the problem (the 2D Array fills up correctly but...) but I'm not sure how to fill the damned dgv...
What I get:

The code:
What the text file looks like:
What I get:

The code:
Code:
Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles btnDisplay.Click
'Display all quotes found in Quote.txt in the grid
Dim lines() As String = IO.File.ReadAllLines("Quote.txt")
Dim rows(,) As String
ReDim rows(lines.Length - 1, 6)
Dim line As String
Dim data() As String
For i As Integer = 0 To rows.GetUpperBound(0)
line = lines(i)
data = line.Split(","c)
For j As Integer = 0 To rows.GetUpperBound(1)
rows(i, j) = data(j)
Next
Next
'The problem seems to be either the query or the dgv...
Dim query = From row In rows.Cast(Of String)()
Select row
dgvQuotes.DataSource = query.ToList
dgvQuotes.CurrentCell = Nothing
End Sub
What the text file looks like:
POL2345,50000,10000,36,20,15,1022.22,8000
POL2345,50000,10000,36,20,15,1022.22,8000