?
Solved

DateTimePicker Binding

Posted on 2012-04-03
1
Medium Priority
?
281 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 1500 total points
ID: 37803114
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Screencast - Getting to Know the Pipeline
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

862 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