I did not do this myself, but the DataGridView is not sealed, so you can create a new class that inherits it. Create a new “DataSourceChanging” event, then override the Setter DataSource property so that it will raise the event first and then actually set the property in the parent class.
Instead, you simply use this datagridview instead of the standard one, and connect your save logic to DataSourceChanging.
source share