Skip to main content
A newer version of this page is available. .

How to: Implement a Custom Validation Procedure

The following example shows how to handle the BaseEdit.Validate event to provide a custom validation procedure.

The image below shows the result:

exDataValidation

private void dxTextEdit_Validate(object sender, DevExpress.Xpf.Editors.ValidationEventArgs e) {
    if (e.Value == null) return;
    if (e.Value.ToString().Length > 4) return;
    e.IsValid = false;
    e.ErrorType = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Information;
    e.ErrorContent = "User ID is less than five symbols. Please correct.";
}