This error comes out whenever I click the datagrid.
The program does fill the datagrid every time data was selected in the combobox.
For example, I choose data1 which has four records in datagrid, and then I click row index no 1. No problem, it will be shown, but when I choose another data again in combobox, for example, Data 2 has only one record then I will again click the datagrid.
This is the time that error will pop up.
Please see the code on how I fill the data grid:
Sub FillDtgPir(ByVal qry As String)
Try
If SQLConn1.State = ConnectionState.Closed Then SQLConn1.Open()
Dim adap As New SqlDataAdapter(qry, SQLConn1)
Me.DtsLineReq1.PRRMS_PIR.Clear()
adap.Fill(Me.DtsLineReq1, "PRRMS_PIR")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Is there missing something in the code?