0

Its a Windows Form Application. Database is MS Access. Using Typed DataSet. I am having a datagridview, which i only use to insert data into database. I want to clear all the rows added as soon as I click on Reset Button on my form. The datagridview is using bindingSource. The Binding Source is using a Typed DataTable from the Typed DataSet

  • Are you looking for [DataTable.RejectChanges](http://msdn.microsoft.com/en-us/library/system.data.datatable.rejectchanges(v=vs.110).aspx)? – oleksii May 19 '13 at 12:38
  • You probably want the code in your question. Or is that the answer? – oleksii May 19 '13 at 12:42

1 Answers1

0

For the following scenario

this.dataGridViewPurDetails.DataSource = this.purchaseDetailBindingSource; 
// purchaseDetailBindingSource 
// this.purchaseDetailBindingSource.DataMember = "PurchaseDetail";
this.purchaseDetailBindingSource.DataSource = this.tVDataSet;

This Solution Worked
//Clear All the rows from the datagridview

BindingSource DT = (BindingSource)dataGridViewPurDetails.DataSource; 
if (DT != null) 
    ((TVDataSet)DT.DataSource).PurchaseDetail.Clear();
Katia
  • 679
  • 2
  • 15
  • 42