DateTime Picker behavior issues

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?a3BpenpsZQ==?=

    DateTime Picker behavior issues

    Hi all.

    using vs.net 9, C#

    I've got a trivial dilemma right now with my datetimepicker.

    It is bound to a datetime field in a database. This field is also set to not
    allow nulls. The default value of this field is: getdate()

    My Picker's properties:
    DataBindings -Value ->tblDataBinding Source - WeDate

    This is the only property besides the name that I have changed.

    Now, I have a it sitting on a form, where I am updating the tblData.
    Currently, the picker shows the current date (as told to with the default
    value). My problem:

    The WeDate field for a new record will, 90% of the time, use the current
    day's date. So...theoretica lly, when the user is entering data, if they need
    today's date, they shouldn't have to even TOUCH the picker, right??????

    Please correct me if I am wrong. It will explain a lot.

    Well, I have a problem. If the user is entering data, and wants to use the
    date that is displayed (getdate()) on startup, they MUST drop the calendar
    down and select the date again, even though it already had the correct date
    to begin with. Otherwise, if they press save, it throws an exception saying
    it needs a value in WeDate.

    I thought setting a default value would make it DEFAULT to today's date
    unless otherwise specified. Or, at least it should.

    I've tried a few things, on AddingNew for the tblDataBindingS ource event:

    setting the focus to the picker (did nothing)
    tried using the enter and dropdown events (i'm not sure what this did - - i
    probably did it wrong)

    I've also tried messing with some of the datetimepicker' s properties:

    checked and moving the databinding to text

    Nothing works.

    My question: Is there any way to programmaticall y drop the picker and select
    the current date?

    That is the only way to get the date to stick to the record. I don't know
    what else to try...and there is not much documentation on this type of
    problem (at least from what I've found).

    Thanks for any help!

Working...