How do I make having a value in the DateTimePicker optional, i.e. I don't want there to be a default value. Is this possible?
Printable View
How do I make having a value in the DateTimePicker optional, i.e. I don't want there to be a default value. Is this possible?
You mean like not having a date?
Normally you set the ShowCheckBox property to True and use the Checked property to indicate whether there's a value or not. You can also set the CustomFormat to a single space to blank the control's text.
Yes, if thats what he means by no default date.
Sorry, not enough info I guess. I want to have a CustomFormat specified to enforce a certain format if a date is selected. But I don't want to have a value when the form first loads. To give you some context, I have 10 DateTimePickers for users to select when they started lunch, finished lunch, started supper, finished supper, etc., etc.. Sometimes they don't take lunch so they don't put a value in that field. So by default I don't want values in the fields but they can pick a date when needed.
I don't see a "ShowTextBox" property.
Thanks for your help.
Set the Format to Custom. Then set the CustomFormat property to a space. Then change the customformat and format properties upon the first selection back to what you need.
Marked this thread resolved to quickly. It doesn't work because the mindate and maxdate prevent you from putting anything other than a valid date in the value field.
Dozens of custom nullable datetimepicker controls have been written. I guess that is the only option.
In your form_load event you could nullify the dtp. Then upon first closeup or lostfocus you can change the style back to what you were using.