I thing that the cell validating event validates the cell it self...you may add validation after the completion of entry before you update your data ..much easier ..you dont force any time .user with canceling his entries...string to a cell, the Cell Error Text Changed event of the Data Grid View control is raised. I can tab to the next cell and the code is not called, then tab back back to the cell (that has the validating), then tab to the next cell and this time it does call the code. There is an e.cancel property that when it is set to true is suppose to keep the focus in the cell but if the code is not invoked what good is that?This example is part of a larger example available in [How to: Validate Data in the Windows Forms Data Grid View Control](~/docs/framework/winforms/controls/how-to-validate-data-in-the-windows-forms-datagridview-control.md).
The cell is then waiting for a correct value and won't let the user to simply cancel&revert his action... That brings home the point that the formatted value may be the cell value or the user-entered value depending on the state the dgv is in. I come from a language where you had 1 event for this kind of thing and here we have 8, so, that's granular, maybe too granular for my simple app but I needed to know which event to code for and now I have an understanding of the vents so I can now decide what to do (PS, it's gonna be On Cell Validating). HTH UPDATE: after downloading this....COMPLETELY helped me to solve my problem of event firing order. I've uploaded the files again and all is working for now at least. My only suggested improvement is to display the formatted value along with the rest of the data in the left column.Hi there, I have a question regarding datagridview, I add data to the datagridview in an interface and all the validation for the datagridview cell is in the datagridview cell validating event for the datagridview.I display the data of the is datagridview in another interface and make the cells read-only. But the thing is when I click on a row that data was added previously and press the Add new row the cell validating event is triggered.