DateTimePicker Control

T

Todd Carnes

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
 
T

Todd Carnes

dUKE said:
You can extend the DateTimePicker control, there is a sample in:
http://www.codeproject.com/KB/selection/extended_datetimepicker.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
 

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