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
- At design time, in the Properties window, select the Spread component.
- Select the Sheets property.
- Click the button to display the SheetView Collection Editor.
- In the Members list, select the sheet in which the cells appear.
- In the property list, select the Cells property and then click the button to display the Cell, Column, and Row Editor.
- Select the cells for which you want to set the cell type.
- In the property list, select the CellType property and choose the Currency cell type or Number cell type or Percent cell type.
- 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.
- Click OK to close the Cell, Column, and Row Editor.
- Click OK to close the SheetView Collection Editor.
- 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.
- 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.
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;
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
- Select the cell or cells in the work area.
- 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.
- Select and set the MaximumValue and MinimumValue properties to the highest and lowest allowable currency values.
- From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.