clear datagrid

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

my datagrid is bind to the table, I need to check clear when the user didn't
input the figure.
my code list as follow. when the datagrid got less then 100 tables, the code
works, However, when it over 100 rows. it can't work.
Does anything wrong with my code ?
Please help
P.S - I can't use delete since the user remove the unused record before
save.

Dim cm As CurrencyManager = Me.BindingContext(dsRvPvHeader,
"myInvTable")
cm.EndCurrentEdit()
For i = 1 To cm.Count
If cm.Current.item("debit") = 0 And
cm.Current.item("credit") = 0 And cm.Current.item("voucherno") =
Me.txtVoucherNo.Text Then
cm.RemoveAt(cm.Position)
Else
cm.Position += 1
End If
Next
End If
cm.Refresh()
cm.EndCurrentEdit()
 
Back
Top