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

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Socket.connect doesn't throw exception in Android -

SPSS keyboard combination alters encoding -