0
votes

enter image description here Hi, friends:

I have a vb.net datagridview which datasource is a datatable. When the user deletes a row in datagridview, it is removed from datagridview and from datatable, but when I debug the data from datatable I can see a deletion symbol (see image) in every datatable's cell. The problem is that I use this datatable to fill a ReportDataSource, and when I create the report, the rows below the deleted row doesn't show. An example:

Row1: "Some cool name", " some cool data" Row2: "Some cool name2", "some cool data2" Row3: "some cool nama3", "some cool data3"

If user deletes Row2, I can see in datagridview is deleted, and in datatable is deleted too, but this makes an error in the ReportDataSource and data doesn't show properly. Does any one of you, guys, how can I overcome this? This must be very simple, there must be a method to refresh de datasource after the deletion.

Thank you very much

1

1 Answers

0
votes

The solution was very simple, but not so simple to find out. Let's say your datagridview it's called dgv1. You just have to add this line in the dgv1.UserDeletedRow event

dgv1.DataSource.acceptchanges

And that's it. Two days spent just for one line. The beauty of Programming ;)