I have a DataGridView associated with a DataView . The grid can be sorted by the user in any column.
I add a row to the grid by calling NewRow in the DataView below the DataTable , and then adding it to the DataTable row collection. How can I select a newly added row in a grid?
I tried to do this by creating a BindingManagerBase object associated with the BindingContext DataView , then setting BindingManagerBase.Position = BindingManagerBase.Count . This works if the grid is not sorted, as a new row is added to the bottom of the grid. However, if the sort order is such that the row is not added at the bottom, this does not work.
How can I reliably set the selected grid row to a new row?
source share