VB.NET, C#
This application demonstrates how to validate the content of the grid at both the cell and row level (including InsertionRow). It handles both custom validation as well as validation handled by the underlying dataset.
How to handle the EndingEdit event of an InsertionRow as well as for each DataRow in the grid (via the DataRowTemplate) to provide custom validation.
How to handle the ValidationError event of an InsertionRow as well as for each DataRow in the grid (via the DataRowTemplate) to prevent the row(s) from leaving edit mode in the case where the validation process fails.
How to handle the EditEnded event of an InsertionRow as well as for each DataRow in the grid (via the DataRowTemplate) to commit modifications made to the grid to the physical data source.
How to handle the LeavingEdit event of each DataCell in the grid (via the DataRowTemplate.Cells collection) to provide custom validation.
How to handle the ValidationError event of each DataCell in the grid (via the DataRowTemplate.Cells collection) to prevent the cell(s) from leaving edit mode in the case where the validation process fails.
How to provide custom error behaviors via the ErrorDescription property of both cell's and CellRow's.
This sample validates the content of the "CustomerID" and "Delivery Agency" columns to make sure that if the values of the cells in the "CustomerID" columns are "VINET", that only "Pickup" and "To be determined" can be selected in the "Delivery Agency" column.
C#: Xceed Samples\Xceed Grid for WinForms v#.#\CSharp\EventValidation\ValidatingCS.csproj
VB.NET: Xceed Samples\Xceed Grid for WinForms v#.#\Visual Basic .NET\EventValidation\ValidatingVB.vbproj