2nd Attempt: Null Dates in DateTimePicker Control

  • Thread starter Thread starter Bruce Vander Werf
  • Start date Start date
B

Bruce Vander Werf

I am looking for a DateTimePicker control that handles null dates.
This is needed in the case where a date has not yet been specified
(e.g. in a database) and you want to indicate and maintain that state.

Is it possible to specify a null date in the DateTimePicker control
written by Ralph Arvesen from smartdevices.microsoftdev.com site?

If this is not possible, is there a similar control that will allow
this functionality?

Thanks...

--Bruce
 
Are you somehow binding the DateTimePicker to a DataSet? Otherwise, I see
no reason why you couldn't set the control to DateTime.Min and then either
handle the logic to set this to null in your database or store it as
DateTime.Min, realizing this is a null entry?

--
_________________________________
Jared Miniman, MS-MVP Mobile Devices
Mobile Computer Consultant

ActiveSync problems?
http://www.microsoft.com/mobile/pocketpc/support/help/activesync.asp
Connection Mngr Q's?
http://www.microsoft.com/mobile/pocketpc/tutorials/connectionmanager
 
Not binding to a DataSet, but I am setting the value of the control to
a value in a DataSet.

I am doing as you suggest, however, the control does display the
minimum date. I would like the date to display empty when there is a
null or unspecified date.

--Bruce
 
Bruce Vander Werf said:
Not binding to a DataSet, but I am setting the value of the control to
a value in a DataSet.

I am doing as you suggest, however, the control does display the
minimum date. I would like the date to display empty when there is a
null or unspecified date.

well i have a textbox and if there is a null date the value is blank

then if the user clicks it the date picker pops up with the default value
(current date)

currently once the picker pops there is no way to return without selecting a
date, but i suppose you could extend the control to include a cancel and/or
clear button

in which case the popup would return an empty string to the textbox and you
preserve your null date

(just to be clear, i don't use the DateTimePicker class, only the
DayPickerPopup class)
 
I use the DateTimePicker.cs offered on a Microsoft site for Compact and
Internationalised
it to support First Day of Week and Date Formating accourding to culture.
This as been testest on the Emulator for all supported Cultures (even
Swahli).
The Name of the Day of Week and Month are recieved from the Maschine but
what
the first Day of Week is and "Today" is must be manuly set.

As to a null Date, the Control must recieve a valid DateTime value as indeed
the DataBase needs.
For this I used 01.01.1900 as a start Date to show that the User does not
want to set the Date
(i.e. Treatment begin, when there is none).

I found no other workaround. Sorry.

Mark Johnson, Berlin Germany
(e-mail address removed)
 
Back
Top