In a VB.NET project I'm building in VS2013 I have some DataGridViews in which, currently only moving to a new cell with theEnter key will retain the previous cell's changes when the Save button is clicked. If the user moves to a new cell using the Tab key, the Arrow keys or mouse-clicking anywhere outside of the cell the change isn't retained.
Put another way: if after editing a DGV cell, the user navigates to another cell by using theEnter key, when the Save button is clicked the edited value is saved to the database, but if, after editing a cell, the user navigates to another cell with any of the other methods (arrow, tab, mouse-out), when the Save button is clicked, then the value the user entered is not saved. It's as if using the Enter key is the only way that the edit value is "committed" to the SqlDataAdapter (or whatever the value goes to for saving to the DB).
I've been watching the CellEndEdit, CellLeave, and CellValidating events and I'm not seeing why it's just using the Enter key that the changed value is retained. Part of that problem is, I'm not sure what property I need to be watching to determine the original and edited values after the different types of navigation are used.
How can I make it so that navigating with mouse, arrows, tab will keep the changes too?
Put another way: if after editing a DGV cell, the user navigates to another cell by using theEnter key, when the Save button is clicked the edited value is saved to the database, but if, after editing a cell, the user navigates to another cell with any of the other methods (arrow, tab, mouse-out), when the Save button is clicked, then the value the user entered is not saved. It's as if using the Enter key is the only way that the edit value is "committed" to the SqlDataAdapter (or whatever the value goes to for saving to the DB).
I've been watching the CellEndEdit, CellLeave, and CellValidating events and I'm not seeing why it's just using the Enter key that the changed value is retained. Part of that problem is, I'm not sure what property I need to be watching to determine the original and edited values after the different types of navigation are used.
How can I make it so that navigating with mouse, arrows, tab will keep the changes too?