ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Desktop.Editing.Attributes Namespace / Attribute.ValidationError Structure / Create Method
Description of the error.
Severity of the error.
Example

In This Topic
    Create Method (Attribute.ValidationError)
    In This Topic
    Creates a new ValidationError.
    Syntax
    Public Shared Function Create( _
       ByVal desc As String, _
       ByVal severity As Severity _
    ) As Attribute.ValidationError

    Parameters

    desc
    Description of the error.
    severity
    Severity of the error.

    Return Value

    The new validation error.
    Example
    Inspector.AddValidate
    var insp = new Inspector();
    insp.LoadSchema(featLayer);
    var attrib = insp.Where(a => a.FieldName == "Mineral").First();
    
    attrib.AddValidate(() =>
    {
      if (attrib.CurrentValue.ToString() == "Salt")
        return Enumerable.Empty<ArcGIS.Desktop.Editing.Attributes.Attribute.ValidationError>();
      else return new[] { ArcGIS.Desktop.Editing.Attributes.Attribute.ValidationError.Create("Error", ArcGIS.Desktop.Editing.Attributes.Severity.Low) };
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also