Monday, November 10, 2014

.net How to allow a datetimepicker control to accept null value?

use the DateTimePicker controls Checked Property to determine where user has selected a value or not.
To Show Check inside DateTimePicker  control set the ShowCheckBox property to true
e.g.

DateTime? generatedOn = null;
if (dateTimePicker1.Checked)
    generatedOn = dateTimePicker1.Value;