I have a DataGridView
that is bound to a DataSet
and I allow someone to remove a row from the table and I remove the row from the set. My code looks like this:
ds.Tables(0).Rows(dgCourseList.SelectedRows(0).Index).Delete()
My problem I found is if the grid gets sorted the index of the rows no longer corresponds to the indexes in the DataSet
. As a result the wrong rows get removed from the set.
Can I solve this problem with maybe having to sort the DataSet on some sort event of the DataGridView
?