Spread Windows Forms 8.0 Product Documentation
Limiting Values for a Numeric Cell

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 are:

For more information about these cell types, refer to the following topics:

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, Number, Percent, Progress, or Slider 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 CurrencyCellTypeNumberCellTypePercentCellTypeProgressCellType, or SliderCellType 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

This example creates a currency cell and sets the minimum and maximum values.

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

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 Currency or other numeric 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.

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback