Spread Windows Forms 6.0 Product Documentation
IsValid Method
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.CellType Namespace > ComboBoxCellType Class : IsValid Method


value
Specified value in the editor control

Glossary Item Box

Determines whether the specified value is valid.

Syntax

Visual Basic (Declaration) 
Public Overrides Function IsValid( _
   ByVal value As Object _
) As Boolean
Visual Basic (Usage)Copy Code
Dim instance As ComboBoxCellType
Dim value As Object
Dim value As Boolean
 
value = instance.IsValid(value)
C# 
public override bool IsValid( 
   object value
)

Parameters

value
Specified value in the editor control

Return Value

true if value in entry is valid; false otherwise

Remarks

The valid range of values is defined by the list of items; see the Items property.

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.
C#Copy Code
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());
Visual BasicCopy Code
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 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.