Home All Groups Group Topic Archive Search About

Representing Null with a DateTimePicker

Author
27 Nov 2007 3:10 PM
jehugaleahsa@gmail.com
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

Author
27 Nov 2007 4:25 PM
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.


--
          - Nicholas Paldino [.NET/C# MVP]
          - mvp@spam.guard.caspershouse.com

<jehugalea***@gmail.com> wrote in message
Show quote
news:42b21539-90f6-4f5b-8394-79aa7a913d57@i12g2000prf.googlegroups.com...
> 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
Author
27 Nov 2007 7:22 PM
Mythran
Show quote
"Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard.caspershouse.com> wrote in
message news:OBdxQGRMIHA.1164@TK2MSFTNGP02.phx.gbl...
> 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]
>          - mvp@spam.guard.caspershouse.com
>
> <jehugalea***@gmail.com> wrote in message
> news:42b21539-90f6-4f5b-8394-79aa7a913d57@i12g2000prf.googlegroups.com...
>> 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
Author
27 Nov 2007 8:04 PM
Finn Stampe Mikkelsen
<jehugalea***@gmail.com> skrev i meddelelsen
news:42b21539-90f6-4f5b-8394-79aa7a913d57@i12g2000prf.googlegroups.com...
> 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
Author
28 Nov 2007 12:08 PM
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




Show quote
On Nov 27, 10:10 am, "jehugalea***@gmail.com" <jehugalea***@gmail.com>
wrote:
> Hello:
>
> We were hoping to allow users to haveDateTimePickervalue 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

AddThis Social Bookmark Button