PC Review


Reply
Thread Tools Rate Thread

DateTimePicker Control

 
 
Todd Carnes
Guest
Posts: n/a
 
      30th Jun 2008
I am trying to write an app in C# that requires the user to enter a date
from 4000 B.C.E to 4000 C.E. I tried to use the DateTimePicker Control
to allow the user to enter the date, but it only supports the Gregorian
Calendar, so the earliest date it allows is in 1752 C.E.

Is there a way to override the DateTimePicker control's minimum allowed
date, or am I forced to resort to the less user-friendly use of three
separate text boxes for month, day and year?

Todd

 
Reply With Quote
 
 
 
 
dUKE
Guest
Posts: n/a
 
      1st Jul 2008
You can extend the DateTimePicker control, there is a sample in:
http://www.codeproject.com/KB/select...imepicker.aspx

Before extending you need to be aware of the following facts:
DateTimePicker has a date range: 1 Jan 1753 - 31 Dec 9998
System.DateTime type has date range: 1 Jan 0001 - 31 Dec 9999
SQL Server DateTime type has date range: 1 Jan 1753 - 31 Dec 9999

--
dUKE


"Todd Carnes" wrote:

> I am trying to write an app in C# that requires the user to enter a date
> from 4000 B.C.E to 4000 C.E. I tried to use the DateTimePicker Control
> to allow the user to enter the date, but it only supports the Gregorian
> Calendar, so the earliest date it allows is in 1752 C.E.
>
> Is there a way to override the DateTimePicker control's minimum allowed
> date, or am I forced to resort to the less user-friendly use of three
> separate text boxes for month, day and year?
>
> Todd
>
>

 
Reply With Quote
 
Todd Carnes
Guest
Posts: n/a
 
      2nd Jul 2008
dUKE wrote:
> You can extend the DateTimePicker control, there is a sample in:
> http://www.codeproject.com/KB/select...imepicker.aspx
>
> Before extending you need to be aware of the following facts:
> DateTimePicker has a date range: 1 Jan 1753 - 31 Dec 9998
> System.DateTime type has date range: 1 Jan 0001 - 31 Dec 9999
> SQL Server DateTime type has date range: 1 Jan 1753 - 31 Dec 9999
>


Thank you very much for the link. I do have one more question.

If I extend the DateTimePicker to accept the dates I require, I
shouldn't need to worry about the limitations you listed above as long
as I'm handling all the actual processing of the dates with my own code,
correct? ... Or will the System.DateTime limitation still be a problem?
(SQL Server's not going to be in the picture for this project.)

Todd
 
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
DateTimePicker Control bug? linuxfedora Microsoft C# .NET 4 13th Nov 2009 12:54 AM
tab control with datetimepicker Darin Microsoft VB .NET 0 11th May 2007 02:42 AM
DateTimePicker Control =?Utf-8?B?TWFya1M=?= Microsoft VB .NET 1 9th Jan 2006 02:57 PM
DateTimePicker Control Dickson Microsoft Dot NET Compact Framework 3 17th Apr 2005 09:34 AM
Datetimepicker control DC Microsoft VB .NET 5 6th Oct 2004 05:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:58 AM.