Representing Null with a DateTimePicker

J

jehugaleahsa

Hello:

We were hoping to allow users to have DateTimePicker value null so
that a unused date is stored on a Database. Does the control support
this? I am pretty sure it doesn't.

How would you go about representing this to a user so they are not
confused?

Thanks,
Travis
 
N

Nicholas Paldino [.NET/C# MVP]

Travis,

This is one of the things that absolutely sucks about the DateTimePicker
control, IMO. To get around this, I usually have a checkbox that
enables/disables the control, and then if the checkbox is not checked, I
consider it a null value.
 
M

Mythran

Nicholas Paldino said:
Travis,

This is one of the things that absolutely sucks about the
DateTimePicker control, IMO. To get around this, I usually have a
checkbox that enables/disables the control, and then if the checkbox is
not checked, I consider it a null value.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hello:

We were hoping to allow users to have DateTimePicker value null so
that a unused date is stored on a Database. Does the control support
this? I am pretty sure it doesn't.

How would you go about representing this to a user so they are not
confused?

Thanks,
Travis

I agree with Nicholas...the DateTimePicker sucks :) So we wrote our own.
That was how we got around it. Now, the DateTimePicker is in the form of a
drop-down with a textbox that stores the users selection. They may also
enter the date in manually instead of selecting the dropdown from the
calendar...(if you implement your own, you may be able to use the existing
DateTimePicker control in the drop-down window if you wish, but only
"select" the date if the user actually clicks on a date).

HTH,
Mythran
 
F

Finn Stampe Mikkelsen

Hello:

We were hoping to allow users to have DateTimePicker value null so
that a unused date is stored on a Database. Does the control support
this? I am pretty sure it doesn't.

How would you go about representing this to a user so they are not
confused?

Thanks,
Travis

Hi Travis

I find that silly to. I have found a control that works around this though.
I have translated it into VB at one time, but have since moved to C#. Below
is the link to the code. It even supports a text to be displayed when the
control value is null...

http://www.codeproject.com/cs/miscctrl/NullableDateTimePicker.asp

I hope this helps you...

/Finn Stampe Mikkelsen
--
Der er 10 slags mennesker - Dem som forstår binær og dem som ikke gør.
There are 10 kinds of people. Those who understand binary ant those who
don't.
Es gibt 10 arten von menschen. Die die binär verstehen bzw. die die es nicht
tuhen
 
V

VisualHint

Hello Travis,

I was using the MS DateTimePicker as an inplace control in Smart
PropertyGrid and among others needed the null value functionnality.
Whatever my effforts, even using some techniques found under
CodeProject there was always something not working to achieve the
level of quality I wanted. That's why I decided to create from scratch
a Field Pack Editor. If a commercial product is an option, I
definitely advise you to check it out. It fixes all the shortcomings
of the MS DateTimePicker, adds flexibility and usability, and this is
a true field editor, not a pseudo solution with a control derived from
the original DateTimePicker or with a textbox or masked textbox

Best regards,

Nicolas Cadilhac @ VisualHint (http://www.visualhint.com)
Home of Smart FieldPackEditor.Net / DateTimePicker replacement (http://
www.visualhint.com/index.php/fieldpackeditor)
Home of Smart PropertyGrid for .Net and MFC (http://www.visualhint.com/
index.php/propertygrid)
Microsoft PropertyGrid Resource List - http://www.propertygridresourcelist.com
 

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