Manipulating a bound datagridview

  • Thread starter Thread starter korey99
  • Start date Start date
K

korey99

Hi-

I'm working on an application that has a datagridview bound to a
datatable, backed by an Access database, through a bindingsource. I
have buttons to add and remove rows, and handlers for those buttons.

My question is, what is the proper/commonly accepted way to (for
example) remove the currently selected row from this
datatable/datagrid? Should I go through the datagridview, the
bindingSource, or the datatable itself? I've gotten the following to
work:

DataRowView drv = (DataRowView)bindingSource.Current;
drv.Delete;

and

DataRowView drv = (DataRowView)dgvAttachments.CurrentRow.DataBoundItem;
drv.Delete;


Thanks,
Korey
 
Back
Top