Spread Windows Forms 12.0 Product Documentation
IsValidRange(SheetView,Boolean) Method
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.Model Namespace > CellRange Class > IsValidRange Method : IsValidRange(SheetView,Boolean) Method
SheetView object with the sheet
Whether to treat the cell range as a span (or else selection)
Determines whether this cell range is valid in the specified sheet and whether to treat as a span.
Syntax
'Declaration
 
Public Overloads Function IsValidRange( _
   ByVal sheetView As SheetView, _
   ByVal isSpan As Boolean _
) As Boolean
'Usage
 
Dim instance As CellRange
Dim sheetView As SheetView
Dim isSpan As Boolean
Dim value As Boolean
 
value = instance.IsValidRange(sheetView, isSpan)
public bool IsValidRange( 
   SheetView sheetView,
   bool isSpan
)

Parameters

sheetView
SheetView object with the sheet
isSpan
Whether to treat the cell range as a span (or else selection)

Return Value

Boolean: true if range is valid; false otherwise
Remarks
If the isSpan parameter is true, the component treats this cell range as a span (entire rows or columns or entire sheet not allowed). If it is false, the component treats this cell range as a selection (entire rows or columns or entire sheet allowed).
Example
This example colors the cells if the range is valid.
FarPoint.Win.Spread.Model.CellRange cr = new FarPoint.Win.Spread.Model.CellRange(0, 0, 3, 3); 
fpSpread1.ActiveSheet.Models.Span.Add(cr.Row, cr.Column, cr.RowCount, cr.ColumnCount); 
bool b = cr.IsValidRange(fpSpread1.ActiveSheet, true); 
if (b) { 
     fpSpread1.ActiveSheet.Cells(cr.Row, cr.Column, cr.RowCount - 1, cr.ColumnCount - 1).BackColor = Color.Red; 
}
Dim cr As New FarPoint.Win.Spread.Model.CellRange(0, 0, 3, 3)
FpSpread1.ActiveSheet.Models.Span.Add(cr.Row, cr.Column, cr.RowCount, cr.ColumnCount)
Dim b As Boolean = cr.IsValidRange(FpSpread1.ActiveSheet, True)
If b Then
     FpSpread1.ActiveSheet.Cells(cr.Row, cr.Column, cr.RowCount - 1, cr.ColumnCount - 1).BackColor = Color.Red
End If
See Also

Reference

CellRange Class
CellRange Members
Overload List