473,395 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

changing culture on datetimepicker

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'";
}

Apr 21 '07 #1
2 20142
Hi,
i dont know if the following link will help you
http://forums.microsoft.com/msdn/sho...49473&siteid=1

Husam Al-a'araj

"ma***********@gmail.com" wrote:
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'";
}

Apr 21 '07 #2
Hi,

Unfortunately it won't be possible with the Microsoft DateTimePicker:
http://support.microsoft.com/Default...9834&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

On Apr 21, 2:59 am, marcussilf...@gmail.com wrote:
I want to change thecultureon aDateTimePicker

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 someculturevariables
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 whichcultureto use
Thread.CurrentThread.CurrentUICulture = m_EnglishCulture;

// In my update GUI method: ifcultureis english =change format of
date
if (CultureInfo.CurrentUICulture.Name == "en-US")
{
this.dateTimePicker1.Format = DateTimePickerFormat.Custom;
this.dateTimePicker1.CustomFormat = "MM'/'dd'/'yyyy'";

}

Apr 21 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: karen.mcdonagh | last post by:
Hi, I have generated resource files for a different language and generated a satellite assembly for it, signed it and placed it in the GAC. When I change the UI culture within the code the...
9
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it...
2
by: Alvaro E. Gonzalez V. | last post by:
Hello everybody; Somebody has a simple example of like applying to the change of Globalization to an application MDI with children windows already opened? HEY!!: That "located" properties of...
4
by: Jacek Jurkowski | last post by:
.... the minimum date of DateTimePicker is 1753-01-01. How to make DateTime to do not show nothing in its text if this date is the value? I have a form with a field LastLogonDate. If user hasn't...
7
by: Clamara | last post by:
When adding a new record from my form, I pre-set my DateTimePicker's value to System.DateTime.Today Since the "Today" value is used most of the time, the user doesn't need to select a date from...
6
by: Mike9900 | last post by:
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...
20
by: andreas | last post by:
When I copy a vb.net project using date formats from one PC with a windows date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then I get errors. How can I change for a while in the...
3
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going...
2
by: tamirmalas | last post by:
Hi, iam trying to set a culture info different than the current culture info on the system, the code compiles fine, but nothing happens, and the system culture is the one used for the program. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.