clear datagrid

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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top