Datagridview cellvalidating not firing

I'm Developing a Windows Forms application with a datagridview bound to a datasource.In the process of validating some cell values the Row Validating Event does not fire when navagation moves off the row. However, if i change a cell value, Tab back to the left to another cell on the same row, then use the mouse to click on a Previous row above the changed row..... Example:: A B C D 1 x x x x 2 x x x x 3 x x x x If I change the value in C2, then backtab (or mouse click) back to B2, Then mouse click on any cell in row 1, the Row Validation Event does not fire and thus the changed value in C2 does not get evaluated. I am using Cell Validating but if one cell is dependant on another I cannot navagate away from the invalid cell to change the parent cell controlling the validation logic.We would not want the Cell Value Changed event firing every single time a letter was added to a person’s last name.Still, it doesn’t make much sense when we think about the way Check Box’s work, in that, they can only ever be On or Off, and that once you have made your selection, you’re probably pretty confident that you want to change the value.

datagridview cellvalidating not firing-27datagridview cellvalidating not firing-86datagridview cellvalidating not firing-69

I understand that the impact in performance should be irrelevant when using simple validation and conditional highlighting rules but I would as much prefer it not to run useless code everytime the user moves to another cell if it can be avoided.

What if someone is able to make a selection without a click event?

There seems to be a non-zero percent chance that this might fire incorrectly in some unforeseen situation.

I have not noticed much in the way of a performance hit (tested with 100 - 5000 rows).

I think in the end it depends on what your validation needs are.

Leave a Reply