Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
'Empty' dates in the UI
Message
General information
Forum:
ASP.NET
Category:
Common Language Runtime
Miscellaneous
Thread ID:
00849664
Message ID:
00849680
Views:
16
Rick,

There is no built in way to support empty dates with the DateTimePicker in WinForms. There are a couple of work-arounds to get the behavior you want:

1. Rewrite your own control that implements this functionality. Here is a third party control that provide capabilities of using empty dates:

http://www.stutteringcontrol.com/index.html
(scroll down the page to find it)

2. Set the Format property of the control to Custom, and put something (like a space or a "-") in the CustomFormat property, you can have the box
appear blank. Then, when a date is selected, you can change the Format property back to Long or Short or just change CustomFormat to whatever you want it to display.

3. Set the ShowCheckBox property to 'True'. If the checkbox is unchecked,
the control can be treated as empty.



>Has anybody figured out a good way to deal with 'empty' or NULL dates in the user interface?
>
>I'd like to use the DateTimePicker, but I can't figure out how to make it use an empty or null date. IOW, set it so that it doesn't show a date.
>
>The problem is that I'm databinding to the control so I get a 'low' date value (which I can trap easily enough) so the value gets set. Now when the value is low I want to clear it out and treat it as an empty date.
>
>Any way to do this?
>
>+++ Rick --
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform