c# - How to ensure localculture is used for interface but not floating point values in WinForms? -
i have winforms application on russian system. number of reasons, prefer using floating-values formatting invariantculture
(which english).
following found solutions in internet, have set invariantculture
default culture application. however, result, localised versions of forms (with russian text) never loaded.
how can ensure forms russian text automatically loaded on russian machines, floating point values string conversions invariantculture
behaviour used?
you can alter property of cultureinfo
after creating specific culture, e.g.:
// create culture default values russian var culture = new cultureinfo("ru-ru"); // change number format culture.numberformat = new numberformatinfo { numberdecimalseparator = "." }; // set culture thread.currentthread.currentculture = thread.currentthread.currentuiculture = culture;
after don't need specify culture parsing/formatting:
var test = double.parse("1.234"); // throw without changing numberformat messagebox.show(test.tostring()); // output: 1.234
wiki
Comments
Post a Comment