Viewing Calendar in a different culture is not working

G

Guest

Hello,

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.
 
C

Claes Bergefall

DateTimePicker and MonthCalendar are hardcoded to use the culture of the
current user (as set in Regional Settings in control panel). This is not a
..NET issue. The problem is in the corresponding Win32 controls.

/claes
 
G

Guest

Hello,
Thank you for the help. This is a good way. I was wondering if I could make
the calendar show the date in the same culture. For example, I change the
regional to Turkish, in control panel, and when I click the DateTimePicker it
shows the date in English, but Turkish format.
 
C

Claes Bergefall

That shouldn't happen. If I set my region to Swedish using the control panel
I get Swedish text and format in the calendar, if I set it to US English I
get US text and format and if I set it to Turkish I get Turkish text and
format.

I'm running on a US version of Windows. Maybe there is a difference in
localized versions of Windows

/claes
 
G

Guest

Hello,

Thank you for your help. I am using US version of Windows 2003 Server.

I meant when I click on the DateTimePicker down arrow and it opens, the
title is in Turkish but the date is in Gregorian date, not the localized
date. But when I select the Gregorian date, it converts the date to Turkish
date and shows it in Turkish in the test box, then if I click the down arrow
and open it it converts it to Gregorian date again. But I was wondering if
yours is the same, or everything is in Turkish date?
 
C

Claes Bergefall

Not sure what you're looking for. I thought Turkey used the Gregorian
calendar. The DateTimePicker doesn't do any conversion when I test it
(everything is a gregorian date as fas as I can tell). Can you give an
example date and what it gets converted to/from (and also what you'ld want
it to be)?

/claes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top