clear datagrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Agnes

    #1

    clear datagrid

    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.BindingConte xt(dsRvPvHeader ,
    "myInvTable ")
    cm.EndCurrentEd it()
    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.EndCurrentEd it()


  • geno1

    #2
    Re: clear datagrid

    Why do you have cm.EndCurrentEd it() twice? Maybe you meant start?


    On Oct 23, 11:40 am, "Agnes" <a...@dynamicte ch.com.hkwrote:
    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.BindingConte xt(dsRvPvHeader ,
    "myInvTable ")
    cm.EndCurrentEd it()
    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.EndCurrentEd it()

    Comment

    Working...