Hi what is the best way to format a decimal amount to string for ui display in the correct culture info?
Many Thanks
Hi what is the best way to format a decimal amount to string for ui display in the correct culture info?
Many Thanks
use:
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false);
Add a format to the ToString: myDecimal.ToString("#.00")
or myDecimal.ToString("C")
.
See http://msdn.microsoft.com/en-us/library/427bttx3.aspx
Why not decimalVar.ToString("F2", CultureInfo.CurrentCulture);
. For format strings (the "F2" part) and what they do, see Standard Numeric Format Strings and Custom Numeric Format Strings