How to get/set current location in windows?

末鹿安然 提交于 2019-12-04 03:45:14

问题


I need to be able to get/set current location in Win 7 (Control Panel -> Regional and Language -> Location):

RegionInfo.CurrentRegion doesn't work (can I use it in wrng way??)

The same with CultureInfo.

Any ideas?


回答1:


Ok you need to change windows register HKEY_CURRENT_USER\Control Panel\International\Geo and there you need change 'Nation'




回答2:


The data is stored in the registry. You need to overwrite these keys.

To know where it's stored in the registry reead this article: http://www.windowsitpro.com/article/registry2/jsi-tip-0311-regional-settings-in-the-registry-




回答3:


You can use this code

CultureInfo _CultureInfo = new CultureInfo("ru-RU");                
            Application.CurrentInputLanguage = InputLanguage.FromCulture(_CultureInfo);
            Application.CurrentCulture = _CultureInfo;



回答4:


Try this: System.Globalization.CultureInfo myCulture = new System.Globalization.CultureInfo("es-ES");



来源:https://stackoverflow.com/questions/10085115/how-to-get-set-current-location-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!