This topic describes how to check validity of data entered by end-users into a data row. This is useful when the integrity of row data is important (for instance, when values in some columns depend on values in others).
The processed row is returned by the event parameter's Row property. Its handle is returned by the RowHandle property. After cell values have been obtained, you can verify whether the values meet your validity criteria. If the row fails validation, set the event's IsValid parameter to false. Otherwise, keep the IsValid parameter set to true.
By default, if the row contains invalid data, the error message box is displayed. Clicking the Yes button returns focus to the row. This allows an end-user to correct row values. If the No button is clicked, the row's changes are discarded and focus can be moved from the row. Note that the rollback occurs only if objects that represent rows implement the System.ComponentModel.IEditableObject interface.
It is possible to provide an additional error description via the event's ErrorText parameter. The string assigned to this parameter will be displayed in the error message box followed by the "Do you want to correct the value?" string. To change the error window's default caption, use the WindowCaption property.