Windows Develop Bookmark and Share   
 index > Windows Forms General > How to initialize DataTimePicker to null
 

How to initialize DataTimePicker to null

Hello,

is it possible to initialize a DataTimePicker field to null instead of some date;

Thank you.
dealwi8me  Saturday, September 26, 2009 7:46 AM
The inability to set the date time picker to an initial "null" or empty value is one of it's greatest criticisms.
There are enhanced versions online which provide this feature.

Wole Ogunremi  Saturday, September 26, 2009 7:57 AM
Khanna Gaurav  Saturday, September 26, 2009 8:03 AM
In the first example (http://www.codeproject.com/KB/selection/Nullable_DateTimePicker.aspx ) i added DateTimePicker.cs to my project, what should i do next?
I'm a little bit of confused...
dealwi8me  Saturday, September 26, 2009 8:37 AM
In the first example (http://www.codeproject.com/KB/selection/Nullable_DateTimePicker.aspx ) i added DateTimePicker.cs to my project, what should i do next?
I'm a little bit of confused...
Before going too far with that, I would give Khanna's suggestion above a try. It's a simpler solution but remember to reset the format when a date is selected...
Wole Ogunremi  Saturday, September 26, 2009 8:47 AM
i did but i get blank value only when initialize form, when adding new record i get MinValue.
I read somewhere that it doesn't work with data bindings and my case is with DataNavigator.
dealwi8me  Saturday, September 26, 2009 8:55 AM
Oh! In that case, back to your previous question. If you've added the .cs file to your project, rebuild your project, and in your toolbox you should have a new group which includes the nullable datetimepicker control and can be dragged to your form.
Wole Ogunremi  Saturday, September 26, 2009 9:03 AM
In myProject Components i have a DateTimePicker.
When i drag it into the form i still get MinValue as default...

Should i add some code as well for override the default DateTimePicker?
dealwi8me  Saturday, September 26, 2009 9:41 AM

You can use google to search for other answers

Custom Search

More Threads

• Getting the children in right z-order from the MDI-container
• creating alias for functionname
• WebBrowser Control
• How to achieve buttons with images in windows
• Charting Tool
• How to set value to DataGridViewCheckBoxColumn in Datagridview control (C# windows form)
• Filter Dataview issue- just not getting it to work
• Message.box (show message without default button)
• SaveDialog issue
• Overriding UserControl.Text bugged? or just unfriendly?