Spread Windows Forms 9.0 Product Documentation
IsValid Method (DateTimeCellType)
Example 


Value to validate (as object)
Determines whether the specified value can be converted to a date-time value and is between the minimum and maximum allowed values.
Syntax
'Declaration
 
Public Overrides Function IsValid( _
   ByVal value As Object _
) As Boolean
'Usage
 
Dim instance As DateTimeCellType
Dim value As Object
Dim value As Boolean
 
value = instance.IsValid(value)
public override bool IsValid( 
   object value
)

Parameters

value
Value to validate (as object)

Return Value

Boolean: true if the value can be converted to a Date-Time object and is between the minimum and maximum allowed values; false otherwise
Remarks
The valid range of values is defined by the MinimumDate, MinimumTime, MaximumDate, and MaximumTime properties.
Example
This example shows the use of the IsValid method for a date-time formatted numeric cell type, but it can be used for other cell types as well.
FarPoint.Win.Spread.CellType.DateTimeCellType dt = new FarPoint.Win.Spread.CellType.DateTimeCellType();
bool b;
dt.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate;
dt.MaximumDate = new System.DateTime(2010, 12, 31);
dt.MinimumDate = new System.DateTime(1990, 1, 1);
fpSpread1.ActiveSheet.Cells[0, 0].CellType = dt;
fpSpread1.ActiveSheet.Cells[0, 0].Value = new System.DateTime(2011, 9, 12);
fpSpread1.ActiveSheet.Cells[1, 0].CellType = dt;
fpSpread1.ActiveSheet.Cells[1, 0].Value = new System.DateTime(1989, 9, 12);
b = dt.IsValid(fpSpread1.ActiveSheet.Cells[0, 0].Value);
listBox1.Items.Add(b.ToString());
Dim dt As New FarPoint.Win.Spread.CellType.DateTimeCellType()
Dim b As Boolean
dt.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate
dt.MaximumDate = New System.DateTime(2010, 12, 31)
dt.MinimumDate = New System.DateTime(1990, 1, 1)
FpSpread1.ActiveSheet.Cells(0, 0).CellType = dt
FpSpread1.ActiveSheet.Cells(0, 0).Value = New System.DateTime(2011, 9, 12)
FpSpread1.ActiveSheet.Cells(1, 0).CellType = dt
FpSpread1.ActiveSheet.Cells(1, 0).Value = New System.DateTime(1989, 9, 12)
b = dt.IsValid(FpSpread1.ActiveSheet.Cells(0, 0).Value)
ListBox1.Items.Add(b.ToString())
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

DateTimeCellType Class
DateTimeCellType Members
MaximumDate Property
MaximumTime Property
MinimumDate Property
MinimumTime Property

 

 


Copyright © GrapeCity, inc. All rights reserved.