Change DateTimePicker Calendar Runtime

Posted by Smart pro on Stack Overflow See other posts from Stack Overflow or by Smart pro
Published on 2011-11-15T18:45:48Z Indexed on 2011/11/26 17:50 UTC
Read the original article Hit count: 268

Filed under:
|
|
|

I want to view the calendar in another culture, for example let it show in Arabic. I use this code in the Main, but the calendar is still in the same culture:

CultureInfo sa = new CultureInfo("ar-SA", false);
sa.DateTimeFormat.Calendar = new System.Globalization.HijriCalendar();
// Sets the culture to Arabic (Saudi Arabia)
Thread.CurrentThread.CurrentCulture = sa;
// Sets the UI culture to Arabic (Saudi Arabia)
Thread.CurrentThread.CurrentUICulture = sa;

I add the DateTimePicker on a form and expect that it shows the date in Arabic after running, but the DateTimePicker or Calendar is not changed to that culture.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET