How can I make a DateTimePicker display an empty string?
Posted
by brass-kazoo
on Stack Overflow
See other posts from Stack Overflow
or by brass-kazoo
Published on 2009-05-11T00:49:24Z
Indexed on
2010/06/18
14:53 UTC
Read the original article
Hit count: 370
I would like to be able to display a DateTimePicker
that has a default value of nothing, i.e. no date.
For example, I have a start date dtTaskStart
and an end date dtTaskEnd
for a task, but the end date is not known, and not populated initially.
I have specified a custom format of yyyy-MM-dd
for both controls.
Setting the value to null
, or an empty string at runtime causes an error, so how can I accomplish this?
I have considered using a checkbox to control the enabling of this field, but there is still the issue of displaying an initial value..
Edit:
Arguably a duplicate of the question DateTimePicker Null Value (.NET), but the solution I found for my problem is not a solution for that question, so I think it should remain here for others to find..
© Stack Overflow or respective owner