VB.Net DateTimePicker databinding

JoseJalapeno used Ask the Experts™
I have a datetimepicker on a form which is bound (value not text) to a datetime field in a SQL database.
The checkbox is enabled.
The field is initially Null value. When the datetimepicker is checked, a date chosen and focus taken away the value does not save to the database. Same applies if there is a default date set. A text box to a text field on the same form and too the same table works.

Does anyone know of a tutorial for databinding the datetimepicker as of course the MSDN is useless.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Technical Director
Jose I have the same problem on a VB.Net 2008 form.  I got around it by binding to the value of the DateTimePicker, and on Focus of the DTP, I did:

myDTP.value = now
MyDTP.text = now.toshortdatestring

If you don't want Now then use your default date.  

This way the date is stored in the database even if you just Tab over the DTP without changing the date.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial