L
lidiya
Guest
Hi,
I have a DataGridView where the user can modify Column1. In turn it also updates Column2. In order for Column2 to be updated immediately after Column1 is changed, I have an event handler for CurrentCellDirtyStateChanged event where the changes in Column1 are committed.
DataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit);
The problem occurs when I try to sort. Lets say I change Column1 in row 3, 5, and 7. Then I click on Column 2 to sort. Im doing a programatic sort on Column2.
DataGridView.Sort(Column2, ListSortDirection.Descending);
Row 7 was the last selected row. Rows 3, and 5 are sorted properly. Row 7 is sorted improperly. If I select another row after changing Row 7, then the sort works fine. From first glance, it looks like the BindingSource that is attached to the DataGridView is not being updated. So, I looked ...several times...the BindingSource does have the correct updated information. Ive also checked the DataGridView and the DataTable, they all have the appropriate row with the updated information.
Any input will be greatly appreciated.
Lida
Continue reading...
I have a DataGridView where the user can modify Column1. In turn it also updates Column2. In order for Column2 to be updated immediately after Column1 is changed, I have an event handler for CurrentCellDirtyStateChanged event where the changes in Column1 are committed.
DataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit);
The problem occurs when I try to sort. Lets say I change Column1 in row 3, 5, and 7. Then I click on Column 2 to sort. Im doing a programatic sort on Column2.
DataGridView.Sort(Column2, ListSortDirection.Descending);
Row 7 was the last selected row. Rows 3, and 5 are sorted properly. Row 7 is sorted improperly. If I select another row after changing Row 7, then the sort works fine. From first glance, it looks like the BindingSource that is attached to the DataGridView is not being updated. So, I looked ...several times...the BindingSource does have the correct updated information. Ive also checked the DataGridView and the DataTable, they all have the appropriate row with the updated information.
Any input will be greatly appreciated.
Lida
Continue reading...