Spread Windows Forms 11.0 Product Documentation
NullIsValid Property (RequiredTypeValidator)
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > RequiredTypeValidator Class : NullIsValid Property
Gets or sets whether the validation is always successful when the specified value is null.
Syntax
'Declaration
 
Public Property NullIsValid As Boolean
'Usage
 
Dim instance As RequiredTypeValidator
Dim value As Boolean
 
instance.NullIsValid = value
 
value = instance.NullIsValid
public bool NullIsValid {get; set;}
Example
This example requires a decimal or null in cell 1,1.
//Type a text string 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.RequiredTypeValidator requiredt = new FarPoint.Win.Spread.RequiredTypeValidator();
requiredt.RequiredType = typeof(decimal);
requiredt.NullIsValid = true;
requiredt.Actions.Add(cnotify);
fpSpread1.Sheets[0].AddValidators(new FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), requiredt);
fpSpread1.Sheets[0].Cells[1, 1].Value = 5;
'Type a text string in cell 1,1 to see the error notification
Dim cnotify As New FarPoint.Win.Spread.CellStyleNotify()
cnotify.InvalidCellStyle.BackColor = Color.Aqua
Dim requiredt As New FarPoint.Win.Spread.RequiredTypeValidator()
requiredt.RequiredType = GetType(Decimal)
requiredt.NullIsValid = True
requiredt.Actions.Add(cnotify)
FpSpread1.Sheets(0).AddValidators(New FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), requiredt)
FpSpread1.Sheets(0).Cells(1, 1).Value = 5
See Also

Reference

RequiredTypeValidator Class
RequiredTypeValidator Members