Hi all,

I'm not sure how to explain this better so here goes:

I have an unbounded DataGrid on a form which I partly populate with data from a CSV file. The code below works well enough (I know it's simplistic) but what happens is that once it's done, there's a lot of empty rows at the bottom of the data. My guess is that the sub keeps adding empty rows for some reason until it reaches maximum rows on the DataGrid.

    Private Sub BtPopulate_Click(sender As Object, e As EventArgs) Handles BtPopulate.Click
        Using AlgoRead As New Microsoft.VisualBasic.
             "W:\WaR\Work\Programming\Visual Basic\CoalWorks AIO\CoalWorks AIO\Data\Miners.csv")
            AlgoRead.TextFieldType = FileIO.FieldType.Delimited
            Dim currentRow As String()
            Dim CurrentRowCount As Integer = 1

            While Not AlgoRead.EndOfData
                    currentRow = AlgoRead.ReadFields()
                    DGAlgoWallets.Item(2, CurrentRowCount - 1).Value = currentRow(0)
                    DGAlgoWallets.Item(3, CurrentRowCount - 1).Value = currentRow(1)
                    DGAlgoWallets.Item(1, CurrentRowCount - 1).Value = False
                    CurrentRowCount = CurrentRowCount + 1
                Catch ex As Microsoft.VisualBasic.
                    MsgBox("Line " & ex.Message &
                    "is not valid and will be skipped.")
                End Try
            End While
        End Using
    End Sub
The data in columns 0 and 4 is ignored. Column 0 contains icons and I haven't created those yet, and column 4 contains strings which the application user adds as needed.

Of course, the intended purpose is for the DataGrid to have exactly the amount of rows that there is data for in the file (currently 57 rows). I have no clue as to why it keeps adding many empty rows.