This documentation is archived and is not being maintained.

ValidationError Class

Represents the base class for all validation errors.

Namespace:  System.Workflow.ComponentModel.Compiler
Assembly:  System.Workflow.ComponentModel (in System.Workflow.ComponentModel.dll)

'Declaration
<SerializableAttribute> _
Public NotInheritable Class ValidationError
'Usage
Dim instance As ValidationError

The following example shows how to create and manipulate validation errors as part of a custom validation routine.

This code example is part of the Send Mail SDK Sample and is from the SendEMailActivity.cs file. For more information, see Send Mail Activity.

Private Sub ValidateEmailProperties(ByVal validationErrors As ValidationErrorCollection, ByVal activity As SendEmailActivity)
    'Validate the To property 
    If String.IsNullOrEmpty(activity.EmailTo) Then 
        Dim validationError As ValidationError = System.Workflow.ComponentModel.Compiler.ValidationError.GetNotSetValidationError(SendEmailActivity.ToProperty.Name)
        validationErrors.Add(validationError)
    ElseIf Not activity.EmailTo.Contains("@") Then 
        Dim validationError As New ValidationError("Invalid To e-mail address", _
          InvalidToAddress, False, SendEmailActivity.ToProperty.Name)
        validationErrors.Add(validationError)
    End If 

    ' Validate the From property 
    If String.IsNullOrEmpty(activity.FromEmail) Then
        validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.FromEmailProperty.Name))
    ElseIf Not activity.FromEmail.Contains("@") Then 
        Dim validationError As New ValidationError("Invalid From e-mail address", _
            InvalidFromAddress, False, SendEmailActivity.FromEmailProperty.Name)
        validationErrors.Add(validationError)
    End If 
End Sub

System.Object
  System.Workflow.ComponentModel.Compiler.ValidationError

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Show: