How to alter a .NET DateTimePicker control to allow enter null values?

GWLlosa picture GWLlosa · Nov 12, 2008 · Viewed 39.6k times · Source

What's the easiest and most robust way of altering the .NET DateTimePicker control, to allow users to enter null values?

Answer

Jan Obrestad picture Jan Obrestad · Nov 19, 2009

You don't need to modify it to do this.

The DateTimePicker in .net actually has a checkbox built-in.

Set the ShowCheckBox property to true.

Then you can use the Checked property to see if the user has entered a value.

http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.showcheckbox(VS.80).aspx