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

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

python - Minimize function with Scipy minimize -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -