如何在.NET中定义应用程序的语言环境 [英] How to define the locale of an application in .NET

查看:70
本文介绍了如何在.NET中定义应用程序的语言环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Windwos XP下的Visual C ++ 2008 Express Edition开发的应用程序,该应用程序可以在一台计算机上正确运行,其中默认的langaunge设置为English.但是,如果在使用默认语言德语的另一台计算机上运行同一应用程序,则会遇到麻烦,因为在使用ToDouble转换为double的过程中无法预定义预定义的字符串Infinity,因为在德语平台上该字符串应为.特别是mscorlib会正确抛出FormatException.

I have an application developted with Visual C++ 2008 Express Edition under Windwos XP, which runs propertly on one computer, where the default langaunge is set to English. However, if run the same application on a different computer with default language German, I run into troubles because a predefined string Infinity is not recoginzed during conversion to double using ToDouble, because on the German platform the string should be Unendlich. In particular the mscorlib throws correctly a FormatException.

如何强制应用程序以英语语言环境运行?我找不到任何选择...

How can I force the application to run with the English locale? I could not yet find any option...

感谢任何提示.

推荐答案

使用Convert :: ToDouble(str,System :: Globalization :: CultureInfo :: InvariantCulture);

Use Convert::ToDouble(str, System::Globalization::CultureInfo::InvariantCulture);

这篇关于如何在.NET中定义应用程序的语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆