Live Chat Icon For mobile
Live Chat Icon

How can I do cell by cell validation in a datagrid

Platform: WinForms| Category: Datagrid

There are problems trying to implement cell by cell validation using the grid’s Validating event architecture. The problem is that the grid is not the object
handling the data. Instead, a TextBox or some other control is the control managing the changing of the cell contents. One way to implement the validation at the grid level is to handle the CurrentCellChanged event, and if the previous cell’s value is not proper, then return to that cell. You can download a sample that implements this process. The sample only handles the validation from cell to cell movement. If you want to handle the validation when the user clicks on the forms Close button, then you would have to add a special event handler for this and do one last validation at this point.

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.