0
votes

I have a DataGridView which do not allow user to add rows. The DataGridView is pre-loaded with some fixed rows. User is required to key in some numeric values on specific column and press [Enter] to jumpt to next row. So, when user press [Enter] key, it jumps to next row and fires the event "CellEndEdit". But when the user reaches the last row and presses [Enter] key, nothing happens, "CellEndEdit" is not firing. How to manually call the method "EndEdit()" when user hit [Enter] key at last row?

I want to get the value of user input to do some calculation automatically.

1

1 Answers

1
votes

CellEndEdit will be invoked when the edit mode ended in the cell and its focus changes. But it will be fired unnecessarily if you are not changing the values in the cell also. So if you just want to do some calculation based on the entered values it is better to use CellValueChanged event so that it will be fired only when the value inside the cell changes and it will work even in the last row cell.