Solved

VB 2008  - Delete all DataGridView records at once

Posted on 2009-07-09
3
361 Views
Last Modified: 2012-05-07
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
0
Comment
Question by:ljcor
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
shahprabal earned 500 total points
Comment Utility
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
 

Author Closing Comment

by:ljcor
Comment Utility
Nice and neat - short and sweet; that's what I wanted.  Thanks greatly.
0
 
LVL 14

Expert Comment

by:shahprabal
Comment Utility
Glad I could help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now