开发者

MS Visual Studio regional settings, numbers

开发者 https://www.devze.com 2023-04-04 21:23 出处:网络
I have been searching the Internet for a solution but not found one, hopefully someone here can help me?

I have been searching the Internet for a solution but not found one, hopefully someone here can help me?

The thing is, I 开发者_JS百科am using MS Visual Studio 2008 and the regional setting is English (United States)

Example, using 1 million: 1,000,000.00

What I need to change this to is European standard, that is 1 million: 1.000.000,00

Perhaps a possibility to change the string format from the US: #,0;(#,0) to the European standard (which I have not found yet)??

Or does anybody have a better solution?

I am using Reporting Services

--EDIT--

MY ANSWER:

OK, for SSRS this is what I did.

Reports -> Properties -> Localization -> Language: es-ES

MS Visual Studio regional settings, numbers

Now my 1 million looks like this:

1.000.000,00


You can do this using NumberFormatInfo (System.Globalization):

NumberFormatInfo nfi = new NumberFormatInfo();
nfi.NumberDecimalSeparator = ",";
nfi.NumberGroupSeparator = ".";
decimal d = 1000000M;
Console.WriteLine(d.ToString("n", nfi));

For applying these settings to the whole application add this code at the beginning (e.g. in the main() method):

CultureInfo ci = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
ci.NumberFormat = nfi;
Thread.CurrentThread.CurrentCulture = ci;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号