how to set datetimepicker default value to empty?
Printable View
how to set datetimepicker default value to empty?
This doesn't really have anything to do with databases so it doesn't belong in the Database forum.
If you're talking about a .NET DateTimePicker then it's not possible. The Value property of the DTP is type DateTime, which is a value type and not nullable. You can display a check box in the control and have an unchecked box indicate a null value, although the Value property will still contain a Date value. You can streamline things a bit by deriving your own class and adding the extra functionality. You'll find already made like that here.
I have resolved the problem for myself. I created an empty text box control. if the date is the default date the textbox is visible is true, if it has a valid date visibility is false. If it starts with a default value "01/01/1900" the text box covers it with an empty box. If the empty text box gets focus the visibility is set to false and the pick calendar is visible.
Works good for me.
Jim :wave: