开发者

How to isolate the regional settings in c#

开发者 https://www.devze.com 2023-03-14 01:21 出处:网络
My product (I\'m using Microsoft.Office开发者_运维知识库.Interop.Excel) is targeted to a Portuguese audience where the comma is the decimal symbol. It have a lot of float and double calculations and p

My product (I'm using Microsoft.Office开发者_运维知识库.Interop.Excel) is targeted to a Portuguese audience where the comma is the decimal symbol. It have a lot of float and double calculations and percentage too. So, when I run the program on a Windows with regional settings set to United States the program runs well, when I run the program on a Windows with regional settings set to Brazil, a lot of wrong things happen, like percentage goes crazy (a lot of zeros and other numbers), some calculations result in a infinite result and more...

My question is, how can I isolate the regional settings in C# solution? Like put a fix regional settings in USA even if the Windows is configured with Brazil? Is this possible? If not, we have other way to fix that?

Thanks in advance.

Lincoln


Have you tried playing around with the System.Globalization.CultureInfo class? Specifically, CultureInfo.CurrentCulture?

0

精彩评论

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