Spread Windows Forms 6.0 Product Documentation
NumberFormat Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.CellType Namespace > GeneralCellType Class : NumberFormat Property


Glossary Item Box

Gets or sets a NumberFormatInfo object that defines the format for displaying a numeric value.

Syntax

Visual Basic (Declaration) 
Public Overridable Property NumberFormat As NumberFormatInfo
Visual Basic (Usage)Copy Code
Dim instance As GeneralCellType
Dim value As NumberFormatInfo
 
instance.NumberFormat = value
 
value = instance.NumberFormat
C# 
public virtual NumberFormatInfo NumberFormat {get; set;}

Property Value

NumberFormatInfo object containing the format for numeric values

Example

This example specifies a NumberFormatInfo which is used to format a currency value.
C#Copy Code
FarPoint.Win.Spread.CellType.GeneralCellType genlcell = new FarPoint.Win.Spread.CellType.GeneralCellType();
System.Globalization.NumberFormatInfo numform = (System.Globalization.NumberFormatInfo)System.Globalization.NumberFormatInfo.CurrentInfo.Clone();
numform.CurrencySymbol = "\xA3";   
Decimal myCurrency = new Decimal( 123456 );
genlcell.NumberFormat = numform;
genlcell.NegativeRed = true;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = genlcell;
fpSpread1.ActiveSheet.Cells[0, 0].Value = myCurrency.ToString( "C", numform );
Visual BasicCopy Code
Dim genlcell As New FarPoint.Win.Spread.CellType.GeneralCellType()
Dim numform As System.Globalization.NumberFormatInfo = CType(System.Globalization.NumberFormatInfo.CurrentInfo.Clone(), System.Globalization.NumberFormatInfo)
numform.CurrencySymbol = Chr(163)
Dim myCurrency As New (Decimal)(123456)
genlcell.NumberFormat = numform
genlcell.NegativeRed = True
FpSpread1.ActiveSheet.Cells(0, 0).CellType = g
FpSpread1.ActiveSheet.Cells(0, 0).Value = myCurrency.ToString("C", numform)

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.