You can set the minimum and maximum values that can be entered in a currency cell and notify the user with a message if the entry is smaller than the minimum or larger than the maximum. This is done with MinimumValue and MaximumValue properties of the CurrencyCellType class.
Double, integer, and percent cells also support minimum and maximum values.
To assign the CurrencyCellType to a cell, refer to Setting a Currency Cell.
Using Code
- Create the currency cell type and set a custom error message.
- Specify the minimum or maximum value or both of a currency cell type.
- Assign the currency cell type to a cell.
Example
C# | Copy Code |
---|---|
FarPoint.Web.Spread.CurrencyCellType currcell = new FarPoint.Web.Spread.CurrencyCellType("Pick a number between 1 and 10!"); currcell.MinimumValue = 1; currcell.MaximumValue = 10; FpSpread1.ActiveSheetView.Cells[1,1].CellType = currcell; |
VB | Copy Code |
---|---|
Dim currcell As New FarPoint.Web.Spread.CurrencyCellType("Pick a number between 1 and 10!") currcell.MinimumValue = 1 currcell.MaximumValue = 10 FpSpread1.ActiveSheetView.Cells(1,1).CellType = currcell |
Using the Spread Designer
- In the work area, select the cell or cells for which you want to set the cell type.
- Select the Home menu.
- Select the SetCellType icon under the CellType section.
- Select the cell type and set cell properties such as MinimumValue, MaximumValue, or ErrorMessage.
- Select OK to close the dialog.
- Click Apply and Exit to close the Spread Designer.