I want to populate a datagridview control with data from a database. The thing is that the datagridview has five columns but the last three are Read only because they populate based on the values of the first two. I'm getting an out of index error. Following is the code and an image of the DGV control and the error.

Code:
 SQL.RunQuery("SELECT partNumber, lineQty FROM SERVICE_ORDER_LINE WHERE servNumber = '" & intValue & "' ")
                ' To verify there is data and that is correct
                Dim debug1, debug3 As String
                Dim debug2, debug4 As Integer
                debug1 = SQL.SQLDS.Tables(0).Rows(0)(0)
                debug2 = SQL.SQLDS.Tables(0).Rows(0)(1)
                debug3 = SQL.SQLDS.Tables(0).Rows(1)(0)
                debug4 = SQL.SQLDS.Tables(0).Rows(1)(1)
                MsgBox(debug1)
                MsgBox(debug2)
                MsgBox(debug3)
                MsgBox(debug4)
                Dim var As Integer = SQL.SQLDS.Tables(0).Rows.Count - 1
                MsgBox(var)
                For i As Integer = 0 To var
                    For j As Integer = 0 To 1
                        frmServiceOrder.dgvPartsSO.Rows(i).Cells(j).Value = SQL.SQLDS.Tables(0).Rows(i)(j)
                    Next
                Next
Name:  dgvPartsSO.PNG
Views: 1538
Size:  3.7 KBName:  displayPartsErr.jpg
Views: 1538
Size:  14.9 KB