GrapeCity.Xaml.SpreadSheet.Data
DataValidator Property (Cell)
Example 


Gets or sets the data validator for a cell.
Syntax
'Declaration
 
<DefaultValueAttribute()>
Public Property DataValidator As DataValidator
'Usage
 
Dim instance As Cell
Dim value As DataValidator
 
instance.DataValidator = value
 
value = instance.DataValidator
[DefaultValue()]
public DataValidator DataValidator {get; set;}

Property Value

A DataValidator object that specifies the validator for the cell. The default value is null.
Example
This example sets the DataValidator property.
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."
Requirements

Target Platforms: Windows Server 2012, Windows RT

See Also

Reference

Cell Class
Cell Members

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options