Rowvalidating e cancel Split sexy chat for middle aged persons
Note that group cells are also counted as rows and, thus, have row indexes.For further information about row indexes, see the Grid Rows topic.Sorry, but I don't understand the reason for setting a bool when showing the Message Box.I have a datagridview with Cell Validating and Row Validating events handled.
What we did was open the form (MODAL and NONMODAL) and changed a value of a cell and then immediately clicked the "X" to close the form.
When the validation fails, the editor is closed, but the user cannot change the current row in the grid until a valid cell value is entered.
In this situation the editor is not kept active when the validation fails and pressing the Esc key does not revert the changes as the editor is already closed.
EDIT You can replace the 'if' clauses with any check you want, including one for data Grid View2. I would use the Selection Changed event and there set the logic to prevent the change.
You can also extend the data Grid View control if you have very complicated requirements. Something like: The bad thing is that the Row Validating event isn't only called from the Validate() method. This is what i meant when I said that this leads to many confusions.