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
 
Back
Top