ValidationEventArgs.SetError(Object, ErrorType) Method

Displays an error within the editor.

Namespace: DevExpress.UI.Xaml.Editors.Native

Assembly: DevExpress.UI.Xaml.Editors.v18.2.dll

Declaration

public void SetError(
    object errorContent,
    ErrorType errorType
)
Public Sub SetError(
    errorContent As Object,
    errorType As ErrorType
)

Parameters

Type Name Description
Object errorContent

An object that specifies the error content.

ErrorType errorType

One of the ErrorType enumeration values.

The SetError method automatically sets the ValidationEventArgs.IsValid property to false. If the errorContent parameter is set to an empty string or null, the ValidationEventArgs.IsValid property is set to true and the error isn't displayed.

private void textEdit_Validate(object sender, ValidationEventArgs e) {
    if(Convert.ToDouble(e.Value) < 0)
        e.SetError("Negative values are not allowed.", ErrorType.Critical);
}

See Also