Net datagridview cellvalidating

net datagridview cellvalidating-83

What's the best place to implement validation logic code and conditional formatting code for a Data Grid View?

In a lot of books and articles that I've read on this control, it seems to suggest that the appropriate event to handle for this is the Cell Validating one. However, this event triggers a bit too often for my tastes and I'm not sure it is required.

column, its value is tested for validity by checking that it is not empty.

If the event handler for the Cell Validating event finds that the value is an empty string, the Data Grid View prevents the user from exiting the cell until a non-empty string is entered.

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.

Comments