[]
You can create a validator that compares a cell value to other values. You can compare DateTime, TimeSpan, or Decimal type (Numeric) values.
A validation error occurs if the value is not valid. You can also create an action, such as adding a text tip to the cell, that lets the user know the value is invalid.
Use the CompareValueValidator class to create the validator. Specify a notification type such as TipNotify. Then use the AddValidators method to add the validator to a cell range.
The following image displays the tip notification for an invalid value.
The following example displays an icon if you type a value less than 5.
//Type a value in cell 1,1
FarPoint.Win.Spread.TipNotify tnote = new FarPoint.Win.Spread.TipNotify();
tnote.ToolTipText = "Greater than 5";
tnote.ToolTipTitle = "Error";
tnote.ToolTipIcon = ToolTipIcon.Error;
FarPoint.Win.Spread.CompareValueValidator compare = new FarPoint.Win.Spread.CompareValueValidator();
compare.ComparedOperator = FarPoint.Win.Spread.ValidateComparisonOperator.GreaterThan;
compare.ComparedValue = 5;
compare.Actions.Add(tnote);
fpSpread1.Sheets[0].AddValidators(new FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), compare);
'Type a value in cell 1,1
Dim tnote As New FarPoint.Win.Spread.TipNotify()
tnote.ToolTipText = "Greater than 5"
tnote.ToolTipTitle = "Error"
tnote.ToolTipIcon = ToolTipIcon.Error
Dim compare As New FarPoint.Win.Spread.CompareValueValidator()
compare.ComparedOperator = FarPoint.Win.Spread.ValidateComparisonOperator.GreaterThan
compare.ComparedValue = 5
compare.Actions.Add(tnote)
fpSpread1.Sheets(0).AddValidators(New FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), compare)
Using a Cell Comparison Validator
Using a Character Format Validator
Using a String Comparison Validator
Using the Exclude List Validator
Using the Include List Validator
Using a Regular Expression Validator
Using a Required Field Validator
Using a Required Type Validator