I have a DataGridView in a C# windows app that I have populated using a DataTable. It works fine for the most part, except when I come to save any changes I have made.
The only editable column is a checkbox column.
When the program is running, if I tick several checkboxes in the column and then save, all the data is saved correctly with the exception of the last box ticked.
I think what's happeneing is that the DataTable used to populate the grid isn't updated when you click the checkbox until the checkbox/grid cell loses focus. I think somehow if I click save direclty after clicking the checkbox, my save methods are running before the DataTable is updated, and so the change is not picked up.
How can I get the DataGridView to update the DataTable as and when the checkboxes are clicked?