private void RemoveNumbersBtn_Click( object sender, EventArgs e ) {
List<PhoneNumber>
selectedRows;
PhoneNumber num;
selectedRows = new List<PhoneNumber>();
foreach ( DataGridViewCell
cell in
MergeNumbersDataGridView.SelectedCells ) {
num
= (PhoneNumber)cell.OwningRow.DataBoundItem;
selectedRows.Add( num );
}
}
MergeNumbersDataGridView.SuspendLayout();
foreach( PhoneNumber
number in selectedRows ) {
MergeNumbersBindingSource.Remove( number );
}
MergeNumbersDataGridView.ResumeLayout();
Wouldn't you want to tell the bindingsource to not raise events during this process? Then tell it to resume event processing at the end and also tell it to reset the bindings.
Otherwise what I think happens is that the collection raises lots of listchanged events, and data binding refreshes much of the form (even though you've stopped display updates for the grid). If you cut off the events at the bindingsource perhaps it would stop a lot of extra data binding work.
Copyright (c) Marimer LLC