Removing rows from datagrid

  • Thread starter Thread starter Charlie@CBFC
  • Start date Start date
C

Charlie@CBFC

Hi:

How do you remove a row from datagrid and will it be reflected in underlying
datatable?

Thanks,
Charlie
 
Here is some button handler code that will remove the current row in teh
grid.

private void button1_Click(object sender, System.EventArgs e)
{
CurrencyManager cm = this.dataGrid1.BindingContext[dataGrid1.DataSource,
dataGrid1.DataMember] as CurrencyManager;
int pos = this.dataGrid1.CurrentRowIndex;
cm.Position = -1;
cm.RemoveAt(pos);
cm.Refresh();
}

==================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top