2nd Attempt: Null Dates in DateTimePicker Control

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
 
J

Jared Miniman [MVP]

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
 
B

Bruce Vander Werf

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
 
K

khorad

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)
 
M

Mark Johnson

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)
 

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