How does one set text of two labels with two different cultural/region format options?
For first label to be ar-EG : Arabic - Egypt
and second one to be en-US : English - United States
?
This to be done for Number/Date/Time/Currency formats.
How does one set text of two labels with two different cultural/region format options?
For first label to be ar-EG : Arabic - Egypt
and second one to be en-US : English - United States
?
This to be done for Number/Date/Time/Currency formats.
Use the culture explicitly in the ToString() method. For example:
DateTime dt = DateTime.Now;
CultureInfo arabic = CultureInfo.GetCultureInfo("ar-EG");
label1.Text = dt.ToString(arabic.DateTimeFormat);
CultureInfo english = CultureInfo.GetCultureInfo("en-US");
label2.Text = dt.ToString(english.DateTimeFormat);
Use CultureInfo.NumberFormat to format numbers.
I think this maybe can solve your problem:
I needed to show different money values in two differents cultural format. So i did this right after each of the code-line asingning the value:
Just remember to add the folowing namespace to the top of your code-file:
and to re-set the previous culture. You can even override the System culture info just by adding those lines on the program.cs