I have:
-
MenuStripthat has File>Save that savesDataGridViewvalues to a database -
DataGridViewthat has columns that must contain number values (I already solved this by using the_CellValidatingevent, settinge.Cancel = truewhen the input is not a number)
The problem is when I click File>Save while cell is still dirty (in edit mode) it’s value is ignored and not included in the database record.
At the beginning of the File>Save handler, call
myDataGridView.EndEdit()to get out of edit mode and be able to get the value of the cell.