?
Solved

DateTimePicker Binding

Posted on 2012-04-03
1
Medium Priority
?
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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 …
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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

649 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