My application features a DataGridView which is attached to a simple List (which I serialize to an XML file). Changing values and adding rows works fine. However when I delete rows from the DataViewGrid the following happens:
- The selected rows disappear in the GUI
- The selected rows get removed from the BindingList
- The main List, however, remains unaltered
The following code is responsible for the deletion:
foreach (DataGridViewRow row in dataGridView.SelectedRows)
{
dataGridView.Rows.Remove(row);
}
As suggested, something like this should work for you:
Should be enough.