I am trying to populate a datagridview from a datatable but I don't want to bind it to the datatable. With the below code it's only displaying data in the last row (see attached picture). There are 5 records in the table. When I single step through the code and watch the row count is changing and the data is changing.
Dim CheckUser As DataTable, intRow As Integer = 0
CheckUser = ReadDataFromDB("SELECT * FROM users;", False)
For Each row In CheckUser.Rows
If Not String.IsNullOrEmpty(row("
UserID").T
oString) Then
'DGridVUsers.CurrentRow.Ce
lls(0).Val
ue = row("UserID").ToString
' DGridVUsers.Rows(intRow).C
ells(0).Va
lue = row("UserID").ToString
With DGridVUsers
.Rows(.Rows.Count - 1).Cells("UserID").Value = row("UserID").ToString
.Rows.Add()
End With
End If
intRow += 1
Next
.Rows(.Rows.Count - 1).Cells("UserID").Value = row("UserID").ToString
getting ROW(-1) the value of your first data row?