CurrencyPositivePattern Property

NumberFormatInfo.CurrencyPositivePattern Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the format pattern for positive currency values.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Public Property CurrencyPositivePattern As Integer

Property Value

Type: System.Int32
The format pattern for positive currency values. The default for InvariantInfo is 0, which represents "$n", where "$" is the CurrencySymbol and n is a number.

ExceptionCondition
ArgumentOutOfRangeException

The property is being set to a value that is less than 0 or greater than 3.

InvalidOperationException

The property is being set and the NumberFormatInfo object is read-only.

This property has one of the values in the following table. The symbol "$" is the CurrencySymbol and n is a number.

Value

Associated pattern

0

$n

1

n$

2

$ n

3

n $

The following example formats a numeric value using each of the four possible values of the CurrencyNegativePattern property for the current culture.


Imports System.Globalization

Public Module Example
   Public Sub Demo(outputBlock As System.Windows.Controls.TextBlock)
      ' Create a read-write NumberFormatInfo object for the current culture.
      Dim numberInfo As NumberFormatInfo = DirectCast(NumberFormatInfo.CurrentInfo.Clone, _
                                                      NumberFormatInfo)
      Dim value As Decimal = 1416.32d

      ' Assign each possible value to the CurrencyPositivePattern property.
      For ctr As Integer = 0 to 3
         numberInfo.CurrencyPositivePattern = ctr
         outputBlock.Text += String.Format("{0,2}: {1}", ctr, _
                                           value.ToString("C", numberInfo)) + vbCrLf
      Next
   End Sub
End Module
' The example displays the following output:
'        0: $1,416.32
'        1: 1,416.32$
'        2: $ 1,416.32
'        3: 1,416.32 $


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft