Spread for ASP.NET 7.0 Product Documentation
Setting a Currency Cell
Support Options
Spread for ASP.NET 7.0 Product Documentation > Developer's Guide > Customizing with Cell Types > Working with Editable Cell Types > Setting a Currency Cell

Glossary Item Box

You can use currency cells to restrict users to entering currency values and to display data as currency values. The currency cell has a default error message that is displayed if the user types an invalid value and tries to leave the cell. This message can be changed using the properties for the currency cell class.

By default, Spread uses the regional Windows settings (or options) for the formatting of currency. The CurrencyCellType class does not use the NumberFormatInfo property inherited from the GeneralCellType. The currency cell type always uses the System.Threading.Thread.CurrentThread.CurrentCulture. These settings are:

You can specify an edit format with the EditMode property and the CurrencyCellType.EditModeSettings class.

For details on the properties and methods for this cell type, refer to the CurrencyCellType class.

See how to define the limits for values at Limiting Values for a Currency Cell.

Currency Cell Type with Note

Using Code

  1. Define a currency cell type by creating an instance of the CurrencyCellType class.
  2. Specify the formatting of a currency cell type.
  3. Assign the currency cell type to a cell.

Example

C# Copy Code
FarPoint.Web.Spread.CurrencyCellType currcell = new FarPoint.Web.Spread.CurrencyCellType();
currcell.MinimumValue = 1;
FpSpread1.ActiveSheetView.Cells[1,1].CellType = currcell; 
VB Copy Code
Dim currcell As New FarPoint.Web.Spread.CurrencyCellType()
currcell.MinimumValue = 1
FpSpread1.ActiveSheetView.Cells(1,1).CellType = currcell 

Using Code

  1. Define a currency cell type by creating an instance of the CurrencyCellType class.
  2. Specify the formatting of a currency cell type.
  3. Assign the currency cell type to a cell.
  4. Set the cell value.

Example

C# Copy Code
FarPoint.Web.Spread.CurrencyCellType c = new FarPoint.Web.Spread.CurrencyCellType();
System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();
nfi.CurrencyDecimalDigits = 3;
nfi.CurrencyDecimalSeparator = ",";
nfi.CurrencySymbol = "$";
c.NumberFormat = nfi;
FpSpread1.ActiveSheetView.Cells[0, 0].CellType = c;
FpSpread1.ActiveSheetView.Cells[0, 0].Value = 234.567;
VB Copy Code
Dim c As New FarPoint.Web.Spread.CurrencyCellType
Dim nfi As New System.Globalization.NumberFormatInfo
nfi.CurrencyDecimalDigits = 3
nfi.CurrencyDecimalSeparator = ","
nfi.CurrencySymbol = "$"
c.NumberFormat = nfi
FpSpread1.ActiveSheetView.Cells(0, 0).CellType = c
FpSpread1.ActiveSheetView.Cells(0, 0).Value = 234.567

Using the Spread Designer

  1. In the work area, select the cell or cells for which you want to set the cell type.
  2. Select the Home menu.
  3. Select the SetCellType icon under the CellType section.
  4. Select the cell type and any other cell properties.
  5. Select OK to close the dialog.
  6. Click Apply and Exit to close the Spread Designer.
© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.