Question

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

Was it helpful?

Solution

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();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top