GrapeCity.Xaml.SpreadSheet.Data
CreateNumberValidator Method
Example 


GrapeCity.Xaml.SpreadSheet.Data Namespace > DataValidator Class : CreateNumberValidator Method
The type of ComparisonOperator compare operator.
The first object.
The second object.
true if the validator is set to a number; otherwise, false.
Creates a validator based on numbers.
Syntax
'Declaration
 
Public Shared Function CreateNumberValidator( _
   ByVal typeOperator As ComparisonOperator, _
   ByVal v1 As Object, _
   ByVal v2 As Object, _
   ByVal isIntegerValue As Boolean _
) As DataValidator
'Usage
 
Dim typeOperator As ComparisonOperator
Dim v1 As Object
Dim v2 As Object
Dim isIntegerValue As Boolean
Dim value As DataValidator
 
value = DataValidator.CreateNumberValidator(typeOperator, v1, v2, isIntegerValue)
public static DataValidator CreateNumberValidator( 
   ComparisonOperator typeOperator,
   object v1,
   object v2,
   bool isIntegerValue
)

Parameters

typeOperator
The type of ComparisonOperator compare operator.
v1
The first object.
v2
The second object.
isIntegerValue
true if the validator is set to a number; otherwise, false.

Return Value

Returns a new validator.
Example
This example uses the CreateNumberValidator method.
gcSpreadSheet1.HighlightInvalidData = true;
var valid = GrapeCity.Xaml.SpreadSheet.Data.DataValidator.CreateListValidator("5,10,15,20");
gcSpreadSheet1.Sheets[0].Cells[0, 1].DataValidator = valid;
gcSpreadSheet1.Sheets[0].Cells[0, 0].Text = "5, 10, 15, and 20 are valid numbers.";

var valid1 = GrapeCity.Xaml.SpreadSheet.Data.DataValidator.CreateNumberValidator(GrapeCity.Xaml.SpreadSheet.Data.ComparisonOperator.GreaterThan, "5", "20", true);
gcSpreadSheet1.Sheets[0].Cells[1, 1].DataValidator = valid1;
gcSpreadSheet1.Sheets[0].Cells[1, 0].Text = "A number greater than 5 is valid.";

var valid2 = GrapeCity.Xaml.SpreadSheet.Data.DataValidator.CreateTextLengthValidator(GrapeCity.Xaml.SpreadSheet.Data.ComparisonOperator.GreaterThan, "4", "20");
gcSpreadSheet1.Sheets[0].Cells[2, 1].DataValidator = valid2;
gcSpreadSheet1.Sheets[0].Cells[2, 0].Text = "Type more than four characters.";
GcSpreadSheet1.HighlightInvalidData = True
Dim valid = GrapeCity.Xaml.SpreadSheet.Data.DataValidator.CreateListValidator("5,10,15,20")
GcSpreadSheet1.Sheets(0).Cells(0, 1).DataValidator = valid
GcSpreadSheet1.Sheets(0).Cells(0, 0).Text = "5, 10, 15, and 20 are valid numbers."

Dim valid1 = GrapeCity.Xaml.SpreadSheet.Data.DataValidator.CreateNumberValidator(GrapeCity.Xaml.SpreadSheet.Data.ComparisonOperator.GreaterThan, "5", "20", True)
GcSpreadSheet1.Sheets(0).Cells(1, 1).DataValidator = valid1
GcSpreadSheet1.Sheets(0).Cells(1, 0).Text = "A number greater than 5 is valid."

Dim valid2 = GrapeCity.Xaml.SpreadSheet.Data.DataValidator.CreateTextLengthValidator(GrapeCity.Xaml.SpreadSheet.Data.ComparisonOperator.GreaterThan, "4", "20")
GcSpreadSheet1.Sheets(0).Cells(2, 1).DataValidator = valid2
GcSpreadSheet1.Sheets(0).Cells(2, 0).Text = "Type more than four characters."
See Also

Reference

DataValidator Class
DataValidator Members