Spread Windows Forms 6.0 Product Documentation
Limiting Values for a Numeric Cell
Support Options
Spread Windows Forms 6.0 Product Documentation > Developer's Guide > Customizing Interaction with Cell Types > Understanding Additional Features of Cell Types > Limiting Values for a Numeric Cell

Glossary Item Box

You can set the minimum and maximum values that can be entered in a cell and notify the user with a message if the entry is smaller than the minimum or larger than the maximum.

The cell types that allow you to set a minimum and maximum value for user entry are:

For other aspects of the currency cell and to assign the CurrencyCellType to a cell, refer to Setting a Currency Cell. For other aspects of the number cell and to assign the NumberCellType to a cell, refer to Setting a Number Cell. For other aspects of the currency cell and to assign the PercentCellType to a cell, refer to Setting a Percent Cell.

For information on the editable cell types, refer to Working with Editable Cell Types.

For information on other features of cell types, refer to Understanding Additional Features of Cell Types.

Using the Properties Window

  1. At design time, in the Properties window, select the Spread component.
  2. Select the Sheets property.
  3. Click the button to display the SheetView Collection Editor.
  4. In the Members list, select the sheet in which the cells appear.
  5. In the property list, select the Cells property and then click the button to display the Cell, Column, and Row Editor.
  6. Select the cells for which you want to set the cell type.
  7. In the property list, select the CellType property and choose the Currency cell type or Number cell type or Percent cell type.
  8. Expand the list of properties under the CellType property. Select and set the MaximumValue and MinimumValue properties to the highest and lowest allowable currency values.
  9. Click OK to close the Cell, Column, and Row Editor.
  10. Click OK to close the SheetView Collection Editor.

Using Code

  1. Set the minimum or maximum value or both for a currency cell by setting the MaximumValue and MinimumValue properties for a CurrencyCellType object or NumberCellType object or PercentCellType object.
  2. Assign the cell type to a cell or range of cells by setting the CellType property for a cell, column, row, or style to the particular cell type object.

Example

C# Copy Code
FarPoint.Win.Spread.CellType.CurrencyCellType currcell = new FarPoint.Win.Spread.CellType.CurrencyCellType("Pick a number between 1 and 10!"); 

currcell.MinimumValue = 1;
 
currcell.MaximumValue = 10;
 
currcell.Multiline = true;
 
fpSpread1.ActiveSheet.Cells[1,1].CellType = currcell;
 
VB Copy Code
Dim currcell As New FarPoint.Win.Spread.CellType.CurrencyCellType("Pick a number between 1 and 10!")
 
currcell.MinimumValue = 1
 
currcell.MaximumValue = 10
 
currcell.Multiline = true
 
FpSpread1.ActiveSheet.Cells(1,1).CellType = currcell
 

Using the Spread Designer

  1. Select the cell or cells in the work area.
  2. In the property list, in the Misc category, select CellType (or right-click on the cells and select the cell type). From the drop-down list, choose the Currency cell type. Now expand the CellType property and various properties are available that are specific to this cell type.
  3. Select and set the MaximumValue and MinimumValue properties to the highest and lowest allowable currency values.
  4. From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.
© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.