all groups > c# > april 2007 >
You're in the

c#

group:

changing culture on datetimepicker


changing culture on datetimepicker marcussilfver NO[at]SPAM gmail.com
4/20/2007 11:59:00 PM
c#:
I want to change the culture on a DateTimePicker

The code below works somewhat. I get the date in english format when
dateTimePicker1 is not expanded. When I click dateTimePicker1 in my
application GUI though (and thereby expands dateTimePicker1, showing
the dates of the month) at the bottommost I see todays date written in
swedish format. Of course I want this to be in english format as well,
but how do I do it?

thanks.

Here is the code:

// set up some culture variables
private ResourceManager m_ResourceManager = new
ResourceManager("myApp.dictionary",
System.Reflection.Assembly.GetExecutingAssembly());
private CultureInfo m_EnglishCulture = new CultureInfo("en-US",true);
private CultureInfo m_SwedishCulture = new CultureInfo("sv-SE", true);

// set which culture to use
Thread.CurrentThread.CurrentUICulture = m_EnglishCulture;

// In my update GUI method: if culture is english => change format of
date
if (CultureInfo.CurrentUICulture.Name == "en-US")
{
this.dateTimePicker1.Format = DateTimePickerFormat.Custom;
this.dateTimePicker1.CustomFormat = "MM'/'dd'/'yyyy'";
}
RE: changing culture on datetimepicker Husam Al-A''araj
4/21/2007 1:28:01 AM
Hi,
i dont know if the following link will help you
http://forums.microsoft.com/msdn/showpost.aspx?postid=49473&siteid=1

Husam Al-a'araj

[quoted text, click to view]
Re: changing culture on datetimepicker VisualHint
4/21/2007 6:01:37 AM
Hi,

Unfortunately it won't be possible with the Microsoft DateTimePicker:
http://support.microsoft.com/Default.aspx?scid=kb%3ben-us%3b889834&x=18&y=19

Best regards,

Nicolas Cadilhac @ VisualHint (http://www.visualhint.com)
Home of Smart PropertyGrid for .Net and MFC
Microsoft PropertyGrid Resource List - http://www.propertygridresourcelist.com



[quoted text, click to view]

AddThis Social Bookmark Button