Saving from a DataGridView
Sat, Jul 22 2006 0:14
If you click on a button in a toolstrip, such as the save button on a BindingNavigator, the button never gets focus, so the DataGridView never looses focus, so the current changes are not persisted.
The first thing you need to do is call EndEdit on the DataGridView. This will apply the cell's changes. But if you are editing a data table, then you also need to call EndEdit on the BindingSource (or EndCurrentEdit on the currency manager if not using a BindingSource). Calling EndEdit on the binding source will result in the row change being persisted and hence the dataset's diffgram will show that change.
So, your code should look something like:
' now save the dataset