Solved

DateTimePicker Binding

Posted on 2012-04-03
1
253 Views
Last Modified: 2012-06-21
Hi,

I know this has been asked before but I still cannot find a solution from the previous posts (missing links to external articles and so on)

I have some dateTimePickers binding to fields in a database. Their default values are set to todays date, the problem is if someone doesn't physically select the date with the mouse, today's date is not recorded in the database, I know I could initially make them blank to force the user to select a date but I would rather it records today's date if no selection is made

Is this possible?

Thank you
0
Comment
Question by:FCapo
1 Comment
 
LVL 38

Accepted Solution

by:
PaulHews earned 500 total points
Comment Utility
I think the problem is that the new record has a null field for the date value that is bound to the datetimepicker, but the datetimepicker cannot display/bind to a null value.  If you want today's date to be saved automatically, you should set the field to equal today's date when you load the form.  Then the binding should work if the user selects a different value.  You would not be able to enter a null value if the field is supposed to be nullable, however.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now