How to clear the added rows from a datagridview binded using a BindingSource c# .net -


its windows form application. database ms access. using typed dataset. having datagridview, use insert data database. want clear rows added click on reset button on form. datagridview using bindingsource. binding source using typed datatable typed dataset

for following scenario

this.datagridviewpurdetails.datasource = this.purchasedetailbindingsource;  // purchasedetailbindingsource  // this.purchasedetailbindingsource.datamember = "purchasedetail"; this.purchasedetailbindingsource.datasource = this.tvdataset; 

this solution worked
//clear rows datagridview

bindingsource dt = (bindingsource)datagridviewpurdetails.datasource;  if (dt != null)      ((tvdataset)dt.datasource).purchasedetail.clear(); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -