This is a Winform C# question.
I have a customized datagridview which is bound to a bindingsource. There is a listener listening to bindingsource.currentchanged event.
When I subscribed the customized datagridview’s sorted event and programmatically select a row, the bindingsource.currentchanged event is not fired:
dataGridViewExtended.Sorted += SortedCompleted;
private void SortedCompleted(...){
// Some code to get rowIndex...
dataGridViewExtended.Rows[rowIndex].Selected = true;
}
Why programmatically change the selection of a datagridview row doesn’t fire the bindingsource.currentchanged? How can I fire that event?
You can use CurrentCell Property to set the CurrentRow.
CurrentRow is ReadOnly.
The Selected property do´nt affect to CurrencyManager.
There are some limitations to change the CurrentRow from code in some DataGridView Events, it can throw exception.
To change CurrentRow from a Dgv Event you can use Control.BeginInvoke to Async post the change.