VB 2008 - Delete all DataGridView records at once

Here is what I want to do (but don't know how to do it!)  Maybe it can't be done this way.  The grid contains Bound data.

    Private Sub cmdDeleteAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDeleteAll.Click

        EvalItemsDataGridView.SelectAll()
        'Call BindingNavigatorDeleteItem_Click()
    End Sub
ljcorAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
shahprabalConnect With a Mentor Commented:
delete all the records in the underlying datatable (assuming thats what your datagridview is bound to).
for each targetRow as datarow in reportdataset.tables("table1").rows
targetRow.delete
next

 
0
 
ljcorAuthor Commented:
Nice and neat - short and sweet; that's what I wanted.  Thanks greatly.
0
 
shahprabalCommented:
Glad I could help.
0
All Courses

From novice to tech pro — start learning today.