แก้ไข

แชร์ผ่าน


IntegerValidator Constructors

Definition

Initializes a new instance of the IntegerValidator class.

Overloads

IntegerValidator(Int32, Int32)

Initializes a new instance of the IntegerValidator class.

IntegerValidator(Int32, Int32, Boolean)

Initializes a new instance of the IntegerValidator class.

IntegerValidator(Int32, Int32, Boolean, Int32)

Initializes a new instance of the IntegerValidator class.

IntegerValidator(Int32, Int32)

Source:
IntegerValidator.cs
Source:
IntegerValidator.cs
Source:
IntegerValidator.cs
Source:
IntegerValidator.cs
Source:
IntegerValidator.cs

Initializes a new instance of the IntegerValidator class.

public:
 IntegerValidator(int minValue, int maxValue);
public IntegerValidator (int minValue, int maxValue);
new System.Configuration.IntegerValidator : int * int -> System.Configuration.IntegerValidator
Public Sub New (minValue As Integer, maxValue As Integer)

Parameters

minValue
Int32

An Int32 object that specifies the minimum value.

maxValue
Int32

An Int32 object that specifies the maximum value.

Remarks

This IntegerValidator constructor ensures that the integer being verified adheres to both a minimum and a maximum length.

Applies to

IntegerValidator(Int32, Int32, Boolean)

Source:
IntegerValidator.cs
Source:
IntegerValidator.cs
Source:
IntegerValidator.cs
Source:
IntegerValidator.cs
Source:
IntegerValidator.cs

Initializes a new instance of the IntegerValidator class.

public:
 IntegerValidator(int minValue, int maxValue, bool rangeIsExclusive);
public IntegerValidator (int minValue, int maxValue, bool rangeIsExclusive);
new System.Configuration.IntegerValidator : int * int * bool -> System.Configuration.IntegerValidator
Public Sub New (minValue As Integer, maxValue As Integer, rangeIsExclusive As Boolean)

Parameters

minValue
Int32

An Int32 object that specifies the minimum value.

maxValue
Int32

An Int32 object that specifies the maximum value.

rangeIsExclusive
Boolean

true to specify that the validation range is exclusive. Inclusive means the value to be validated must be within the specified range; exclusive means that it must be below the minimum or above the maximum.

Examples

The following code example demonstrates how to use the IntegerValidator constructor. This code example is part of a larger example provided for the IntegerValidator class.

// Create Validator for the range of 1 to 10 inclusive
int minIntVal = 1;
int maxIntVal = 10;
bool exclusive = false;
IntegerValidator integerValidator =
    new IntegerValidator(minIntVal, maxIntVal, exclusive);
' Create Validator for the range of 1 to 10 inclusive
Dim minIntVal As Int32 = 1
Dim maxIntVal As Int32 = 10
Dim exclusive As Boolean = False
Dim validator As IntegerValidator = _
    New IntegerValidator(minIntVal, maxIntVal, exclusive)

Remarks

When creating an instance of the IntegerValidator class, this IntegerValidator constructor checks both the minimum and maximum Int32 values, as well as whether the validation range is exclusive. When the rangeIsExclusive parameter is set to true, the Int32 value must not be between the minValue and maxValue parameter values.

Applies to

IntegerValidator(Int32, Int32, Boolean, Int32)

Source:
IntegerValidator.cs
Source:
IntegerValidator.cs
Source:
IntegerValidator.cs
Source:
IntegerValidator.cs
Source:
IntegerValidator.cs

Initializes a new instance of the IntegerValidator class.

public:
 IntegerValidator(int minValue, int maxValue, bool rangeIsExclusive, int resolution);
public IntegerValidator (int minValue, int maxValue, bool rangeIsExclusive, int resolution);
new System.Configuration.IntegerValidator : int * int * bool * int -> System.Configuration.IntegerValidator
Public Sub New (minValue As Integer, maxValue As Integer, rangeIsExclusive As Boolean, resolution As Integer)

Parameters

minValue
Int32

An Int32 object that specifies the minimum length of the integer value.

maxValue
Int32

An Int32 object that specifies the maximum length of the integer value.

rangeIsExclusive
Boolean

A Boolean value that specifies whether the validation range is exclusive.

resolution
Int32

An Int32 object that specifies a value that must be matched.

Exceptions

resolution is less than 0.

-or-

minValue is greater than maxValue.

Remarks

The Int32 value being validated must be equal to the resolution value in order to pass validation.

Applies to