Writting on Regional Settings

  • Thread starter Thread starter Felipe T.
  • Start date Start date
F

Felipe T.

Hi,
I can get the Decimal Digit Separator of the regional Settings using
System.Globalization.NumberFormatInfo.CurrentInfo.CurrencyDecimalDigits().

Actually, i can get any info about the regional settings, but i dont know a
way to write on it.

Anyone knows a way?
 
This sample code might help...

using System;
using System.Globalization;

class NumberFormatInfoSample {

public static void Main() {

// Gets a NumberFormatInfo associated with the en-US culture.
NumberFormatInfo nfi = new CultureInfo( "en-US", false ).NumberFormat;

// Displays a negative value with the default number of decimal
digits (2).
Int64 myInt = -1234;
Console.WriteLine( myInt.ToString( "C", nfi ) );

// Displays the same value with four decimal digits.
nfi.CurrencyDecimalDigits = 4;
Console.WriteLine( myInt.ToString( "C", nfi ) );

}
}


/*
This code produces the following output.

($1,234.00)
($1,234.0000)
*/

Thanks,
Sandy

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top