INumericFormat Interface

Provides access to members that format numbers.

Description

The members in the INumericFormatinterface define how the ValueToString**method in the associated INumberFormat**interface formats numbers.

When To Use

Use the INumericFormatinterface to format numbers with any of the objects listed under CoClassesbelow.

Members

Name Description
Read/write property AlignmentOption The alignment option applied to the ValueToString method.
Read/write property AlignmentWidth The alignment width applied to the ValueToString method.
Read/write property RoundingOption The rounding option applied to the ValueToString method.
Read/write property RoundingValue The rounding value, whose meaning depends on the rounding option.
Read/write property ShowPlusSign Indicates if formatted numbers contain a plus sign for positive numbers.
Read/write property UseSeparator Indicates if formatted numbers contain digit grouping symbols.
Read/write property ZeroPad Indicates if formatted numbers contain padded zeros to the right of the decimal.

INumericFormat.AlignmentOption Property

The alignment option applied to the ValueToString method.

Public Property AlignmentOption As esriNumericAlignmentEnum
public esriNumericAlignmentEnum AlignmentOption {get; set;}

Description

The AlignmentOptionproperty sets or returns an option that tells the ValueToString method in the associated INumberFormat****interface how to align formatted numbers. For example, the value �0.34�, formatted as a string with an AlignmentWidth of 5, is returned as �0.34� with an AlignmentOption of esriAlignRight and �0.34� with an AlignmentOption of esriAlignLeft.

The settings for AlignmentOptionare:

Setting Description
**esriAlignRight** (Default) Numbers are aligned to the right. If the AlignmentWidth**property is wider than the resulting formatted number, spaces are padded at the left to make the output AlignmentWidthcharacters wide. If the formatted number is wider than AlignmentWidth, the number is not truncated (the same as it would be if **AlignmentOption**were set to esriAlignLeft**).
esriAlignLeft Numbers are aligned to the left. No spaces are padded either at the left or right. If AlignmentOptionis set to esriAlignLeft, the AlignmentWidth****property is ignored.

INumericFormat.AlignmentWidth Property

The alignment width applied to the ValueToString method.

Public Property AlignmentWidth As Integer
public int AlignmentWidth {get; set;}

Description

The AlignmentWidthproperty sets or returns the width (default: 12) of the resulting string the ValueToString**method in the associated INumberFormat**interface produces.

If the AlignmentOption**property is set to esriAlignRight, the formatted number will be AlignmentWidthcharacters wide, padding spaces to the left of the number as needed. If AlignmentOption = esriAlignLeft, the AlignmentWidth**property is ignored. The width includes plus signs and any decimal points. For example, +1,234.56 has a width of 9.

Remarks

If AlignmentOption= esriAlignRight, make sure AlignmentWidthis set wide enough to handle the resulting formatted number. If it is not, the number will not be truncated, but the length of the formatted number will be longer than the AlignmentWidth.

INumericFormat.RoundingOption Property

The rounding option applied to the ValueToString method.

Public Property RoundingOption As esriRoundingOptionEnum
public esriRoundingOptionEnum RoundingOption {get; set;}

Description

The RoundingOptionproperty sets or returns the rounding option to be used when the ValueToString method in the associated INumberFormat****interface formats numbers.

The settings for RoundingOptionare:

Setting Description
**esriRoundNumberOfDecimals** (Default) Numbers are rounded to the number of decimal places defined in the RoundingValue property.If ZeroPad**is also set True, decimal zeros are appended at the right up to the number of places indicated in the RoundingValue** property.
esriRoundNumberOfSignificantDigits Numbers are rounded to the number of significant digits indicated in the RoundingValue property.To format numbers and express significant zeros at the right of the decimal, set ZeroPad**True. For example, the number 12.0345 in 8 significant digits is the number 12.034500. In order to express the rightmost significant zeros, ZeroPadshould be set True. With ZeroPadset False, the formatted number would be 12.0345.**

INumericFormat.RoundingValue Property

The rounding value, whose meaning depends on the rounding option.

Public Property RoundingValue As Integer
public int RoundingValue {get; set;}

Description

The RoundingValueproperty sets or returns the number of decimal places or significant digits (default: 6) to round a number to when the ValueToString**method in the associated INumberFormat**interface formats numbers.

INumericFormat.ShowPlusSign Property

Indicates if formatted numbers contain a plus sign for positive numbers.

Public Property ShowPlusSign As Boolean
public bool ShowPlusSign {get; set;}

Description

The ShowPlusSignproperty sets or returns an indicator that tells whether or not a plus sign symbol (+) is to be prefixed to positive numbers when the ValueToString**method in the associated INumberFormat**interface formats numbers.

The settings for ShowPlusSignare:

Setting Description
**False** (Default) Positive numbers and zero values are formatted without a plus sign. Negative values are formatted with a minus (-) sign.
True Positive numbers are formatted with a plus (+) sign. Zero values are formatted without a plus sign. Negative numbers are formatted with a minus (-) sign.

Remarks

Using ShowPlusSigncan be useful in conjunction with IFormattedGridLabel, where a user might not know if the number is above or below the Equator, or east or west of the Central Meridian.

Also see the ShowDirections****property in ILatLonFormat.

INumericFormat.UseSeparator Property

Indicates if formatted numbers contain digit grouping symbols.

Public Property UseSeparator As Boolean
public bool UseSeparator {get; set;}

Description

The UseSeparatorproperty sets or returns an indicator that tells whether to include a digit grouping symbol when the ValueToString****method in the associated INumberFormat interface formats numbers.

The settings for UseSeparatorare:

Setting Description
**False** (Default) Numbers are formatted without a digit grouping symbol, for example, 1234567.89.
True Numbers are formatted with a digit grouping symbol, for example, 1,234,567.89.

Remarks

Numbers are formatted using the current regional settings defined for the system at runtime. To change the separator symbol or where the separator appears in the formatted number, change the settings on the _Number_tab of Control Panel's _Regional Settings_applet.

INumericFormat.ZeroPad Property

Indicates if formatted numbers contain padded zeros to the right of the decimal.

Public Property ZeroPad As Boolean
public bool ZeroPad {get; set;}

Description

The ZeroPadproperty sets or returns an indicator that tells whether to pad zeros at the right of the decimal when the ValueToString method in the associated INumberFormat****interface formats numbers.

The settings for ZeroPadare:

Setting Description
**False** (Default) Numbers are formatted without padding decimal zeros. The last decimal digit (to the right of the decimal point) is a non-zero digit.
True Decimal zeros or significant digit zeros are appended at the right of the decimal point up to the number of places indicated in the RoundingValue property.The RoundingOption setting determines whether decimal zeros or significant digit zeros are appended.

Remarks

To format numbers and express significant zeros at the right of the decimal, set ZeroPadTrue. For example, the number 12.0345 in 8 significant digits is the number 12.034500. In order to express the rightmost significant zeros, ZeroPadshould be set True. With ZeroPadset False, the formatted number would be 12.0345.

Classes that implement INumericFormat

Classes Description
AngleFormat An object for formatting numbers in an angle format.
LatLonFormat An object for formatting numbers in a lat/lon format.
NumericFormat An object for formatting numbers in a variety of numeric formats.
PercentageFormat An object for formatting numbers in a percentage format.
RateFormat An object for formatting numbers in a rate format.

Remarks

The format produced with the NumericFormatcoclass object is determined solely on the INumericFormatinterface property settings. Formats produced with other objects listed under CoClassesdepend on _two_interface's property settings. These objects inherit the INumericFormatinterface in addition to their own default interface.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.