PC Review


Reply
Thread Tools Rate Thread

Date Format Changes from Regional Settings

 
 
Naeem
Guest
Posts: n/a
 
      5th Dec 2005
HI All,

I have a problem can anyone help?

We are using DateTimePicker control for date editing on many forms.
Now we have a special requirement that if a user will change the datetime
format from the regional settings then the new datetime format must not
update in the DateTimePicker control (which actually updates those changes
on runtime) untrill user will restart the application.

I tried to find any solution but failed. Can anyone help?

Thanks
Naeem


 
Reply With Quote
 
 
 
 
Truong Hong Thi
Guest
Posts: n/a
 
      5th Dec 2005
Hi Naeem,

You can set DateTimePicker.Format to Custom at initilization (e.g, in
FormLoad, or in constructor after InitializeComponents). For example:

picker.Format = DateTimePickerFormat.Custom;
picker.CustomFormat = DateTimeFormatInfo.CurrentInfo.LongDatePattern;

Thus at initialization, the picker's format will be set as defined in
Regional Settings. After you changed it, the picker is not affected
(cos it uses custom format). Next time you run the app, it is
initialized again and match what you set in regional settings.

Hope this helps,
Thi

 
Reply With Quote
 
Naeem
Guest
Posts: n/a
 
      5th Dec 2005
It worked

Thanks Thi

"Truong Hong Thi" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Naeem,
>
> You can set DateTimePicker.Format to Custom at initilization (e.g, in
> FormLoad, or in constructor after InitializeComponents). For example:
>
> picker.Format = DateTimePickerFormat.Custom;
> picker.CustomFormat = DateTimeFormatInfo.CurrentInfo.LongDatePattern;
>
> Thus at initialization, the picker's format will be set as defined in
> Regional Settings. After you changed it, the picker is not affected
> (cos it uses custom format). Next time you run the app, it is
> initialized again and match what you set in regional settings.
>
> Hope this helps,
> Thi
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Time format according to the Regional settings of Pocket PC vikash Microsoft Dot NET Compact Framework 0 31st Jan 2006 12:13 PM
Re: Regional settings and date format problem Fred Flintstone Microsoft VB .NET 1 24th Aug 2005 04:53 PM
Getting client side regional settings date format =?Utf-8?B?b3B0aWNzdG9ybQ==?= Microsoft ASP .NET 3 12th Jul 2005 02:34 PM
Re: Setting date format, regional settings for ASP.NET Phil Winstanley [Microsoft MVP ASP.NET] Microsoft ASP .NET 0 15th Jun 2004 09:15 AM
Setting date format, regional settings for ASP.NET =?Utf-8?B?RGF2aWQgTGVlIEFV?= Microsoft ASP .NET 0 15th Jun 2004 03:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:20 AM.