Spread Windows Forms 12.0 Product Documentation
NullIsValid Property (TextLengthValidator)
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > TextLengthValidator Class : NullIsValid Property
Gets or sets whether the validation always succeeds when the specified value is a null reference (Nothing in Visual Basic).
Syntax
'Declaration
 
Public Property NullIsValid As Boolean
'Usage
 
Dim instance As TextLengthValidator
Dim value As Boolean
 
instance.NullIsValid = value
 
value = instance.NullIsValid
public bool NullIsValid {get; set;}

Property Value

true if the validation always succeeds when the specified value is a null reference (Nothing in Visual Basic); otherwise, false. The default is true.
Remarks
If the cell's value is a null reference (Nothing in Visual Basic), you can determine whether the validation always succeeds.
Example
This example uses the text length validator.
//Type a text string that contains more than 6 characters in cell 1,1 to see the error notification
FarPoint.Win.Spread.CellStyleNotify cnotify = new FarPoint.Win.Spread.CellStyleNotify();
cnotify.InvalidCellStyle.BackColor = Color.Aqua;
FarPoint.Win.Spread.TextLengthValidator tvalid = new FarPoint.Win.Spread.TextLengthValidator();
tvalid.LengthUnit = FarPoint.Win.Spread.LengthUnit.Char;
tvalid.MaximumLength = 6;
tvalid.MinimumLength = 0;
tvalid.NullIsValid = true;
tvalid.Actions.Add(cnotify);
fpSpread1.Sheets[0].AddValidators(new FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), tvalid);
'Type a text string that contains more than 6 characters in cell 1,1 to see the error notification
Dim cnotify As New FarPoint.Win.Spread.CellStyleNotify()
cnotify.InvalidCellStyle.BackColor = Color.Aqua
Dim tvalid As New FarPoint.Win.Spread.TextLengthValidator()
tvalid.LengthUnit = FarPoint.Win.Spread.LengthUnit.Char
tvalid.MaximumLength = 6
tvalid.MinimumLength = 0
tvalid.NullIsValid = True
tvalid.Actions.Add(cnotify)
FpSpread1.Sheets(0).AddValidators(New FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), tvalid)
See Also

Reference

TextLengthValidator Class
TextLengthValidator Members