Localization NumberFormat : NumberFormat « Internationalization I18N « VB.Net

Localization NumberFormat


Imports System.Globalization
Imports System.Threading

Module Module1

   Sub Main()

      Dim FRCulture As New CultureInfo("fr-FR")
      Dim MyCulture As New CultureInfo(Thread.CurrentThread.CurrentUICulture.LCID)
      Dim Vnf As NumberFormatInfo

      Console.WriteLine(123456.ToString("c", MyCulture))

      Vnf = MyCulture.NumberFormat
      Vnf.CurrencyDecimalSeparator = ","
      Vnf.CurrencyGroupSeparator = "."
      Vnf.NumberDecimalSeparator = ","
      Vnf.NumberGroupSeparator = "."
      MyCulture.NumberFormat = Vnf

      Console.WriteLine(123456.ToString("C", MyCulture))

      MyCulture.NumberFormat = FRCulture.NumberFormat
      Console.WriteLine(123456.ToString("c", MyCulture))
   End Sub
End Module


Related examples in the same category

1.Ordinal Numbers
2.NumberFormatInfo recognizes "pos" and "neg"