ValidatorInstance Property
Collapse the table of content
Expand the table of content

IntegerValidatorAttribute.ValidatorInstance Property

 

Gets an instance of the IntegerValidator class.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

Public Overrides ReadOnly Property ValidatorInstance As ConfigurationValidatorBase

You use the ValidatorInstance property to perform string validation by calling its Validate method.

The following example shows how to use the ValidatorInstance property.

        Dim valBase As ConfigurationValidatorBase
        Dim intValAttr As IntegerValidatorAttribute
        intValAttr = New IntegerValidatorAttribute()

        Dim badValue As Long = 10
        Dim goodValue As Integer = 10

        Try
            valBase = intValAttr.ValidatorInstance
            valBase.Validate(goodValue)
            ' valBase.Validate(badValue);
        Catch e As ArgumentException
            ' Display error message.
            Dim msg As String = e.ToString()
#If DEBUG Then
            Console.WriteLine(msg)
#End If
        End Try '

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft