Dear Experts
Table gpass has data as
gate-----date-----c----bno----acccode----tittle----weight-------qty
1----18/01/2010---a----2--------2----------abc-----10.00-------15
Then there are two textbox having values as
txtgat.text=1
txtdat.text=18/01/2010
I these codes and it generates error message as
ArgumentOutOfRangeException was unhandled.
Idex was out of range. Must be non-negative and less than the size of collection. Parameter name: Index
What mistake I am doing, please modify
Private Sub txtGat_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtGat.TextChanged
If Len(Me.txtGat.Text) > 0 AndAlso Me.txtDat.Text IsNot Nothing Then
str = "Select * from gpass where vou_no= " & Val(Me.txtGat.Text) & " And Date = '" & Me.txtDat.Text & "'"
dt = GetTable(str)
If (dt.Rows.Count > 0) Then
Me.txtCir.Text = dt.Rows(0)("c")
Me.txtVou.Text = dt.Rows(0)("bno")
cmd.ExecuteNonQuery()
End If
For i = 0 To dt.Rows.Count -1
Me.DataGridView1.Rows.Add()
Me.DataGridView1.Rows(i).Cells(0).Value = Val(dt.Rows(i).Item(1))
Me.DataGridView1.Rows(i).Cells(1).Value = Trim(dt.Rows(i).Item(2))
Me.DataGridView1.Rows(i).Cells(2).Value = Val(dt.Rows(i).Item(3))
Me.DataGridView1.Rows(i).Cells(3).Value = Val(dt.Rows(i).Item(4))
Next
End If
End Sub