PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms The Infamous DateTimePicker

Reply

The Infamous DateTimePicker

 
Thread Tools Rate Thread
Old 07-01-2007, 03:30 PM   #1
Earl
Guest
 
Posts: n/a
Default The Infamous DateTimePicker


I have what I consider to be an unusual issue. In the past, I've not used
data-binding with the DTPs. So I'm finding some of the old issues raising
their ugly heads in a new fashion.

First a caveat: All other controls and data work properly on this form.
Updates, deletes, inserts, all as advertised. The DTPs are bound to
smalldatetime columns in the database. The bindingsource is bound to the
table, the controls to the bindingsource.

The DTPs are set up as follows:
ShowCheckBox = True
Checked = True
Format = Short

My understanding of the DTP in the past has been that an unchecked control
indicates a null. In the past, when I manually saved the values from the
DTPs, I could save a null back to the database. But now, when I uncheck a
DTP and save, the originally saved date remains in the database. If I change
the value in the DTP (even if unchecked), the value in the database changes.

So what gives with the binding? How in the world to null a value from the
DTP when it is bound? Finally, who created this godforsaken control!?


  Reply With Quote
Old 07-01-2007, 03:41 PM   #2
Eric Moreau
Guest
 
Posts: n/a
Default Re: The Infamous DateTimePicker

see if an article I have written can answer your question :
http://www.emoreau.com/Entries/Arti...er-control.aspx

--


HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
S2i web inc. (www.s2i.com)
http://emoreau.s2i.com/

"Earl" <brikshoe@newsgroups.nospam> wrote in message
news:%23cVHCDnMHHA.780@TK2MSFTNGP03.phx.gbl...
>I have what I consider to be an unusual issue. In the past, I've not used
>data-binding with the DTPs. So I'm finding some of the old issues raising
>their ugly heads in a new fashion.
>
> First a caveat: All other controls and data work properly on this form.
> Updates, deletes, inserts, all as advertised. The DTPs are bound to
> smalldatetime columns in the database. The bindingsource is bound to the
> table, the controls to the bindingsource.
>
> The DTPs are set up as follows:
> ShowCheckBox = True
> Checked = True
> Format = Short
>
> My understanding of the DTP in the past has been that an unchecked control
> indicates a null. In the past, when I manually saved the values from the
> DTPs, I could save a null back to the database. But now, when I uncheck a
> DTP and save, the originally saved date remains in the database. If I
> change the value in the DTP (even if unchecked), the value in the database
> changes.
>
> So what gives with the binding? How in the world to null a value from the
> DTP when it is bound? Finally, who created this godforsaken control!?
>



  Reply With Quote
Old 07-01-2007, 08:19 PM   #3
Earl
Guest
 
Posts: n/a
Default Re: The Infamous DateTimePicker

Thanks Eric, very nice article, and certainly on the right track to what I'm
trying to do. I can see how you would do that manually binding to a dataset,
but how would you handle the situation where the control is bound to the
bindingsource (with the datasource of the bindingsource being the strongly
typed dataset)? It almost looks as if the DTP has to be unbound from the
bindingsource and manually bound to the strongly typed dataset (which
doesn't work very well because a datagridview is also bound to the
bindingsource, keeping all in synch)

"Eric Moreau" <eric.moreau_N_O_S_P_A_M@videotron.ca> wrote in message
news:u01IWJnMHHA.5000@TK2MSFTNGP03.phx.gbl...
> see if an article I have written can answer your question :
> http://www.emoreau.com/Entries/Arti...er-control.aspx
>
> --
>
>
> HTH
>
> Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
> Conseiller Principal / Senior Consultant
> S2i web inc. (www.s2i.com)
> http://emoreau.s2i.com/
>
> "Earl" <brikshoe@newsgroups.nospam> wrote in message
> news:%23cVHCDnMHHA.780@TK2MSFTNGP03.phx.gbl...
>>I have what I consider to be an unusual issue. In the past, I've not used
>>data-binding with the DTPs. So I'm finding some of the old issues raising
>>their ugly heads in a new fashion.
>>
>> First a caveat: All other controls and data work properly on this form.
>> Updates, deletes, inserts, all as advertised. The DTPs are bound to
>> smalldatetime columns in the database. The bindingsource is bound to the
>> table, the controls to the bindingsource.
>>
>> The DTPs are set up as follows:
>> ShowCheckBox = True
>> Checked = True
>> Format = Short
>>
>> My understanding of the DTP in the past has been that an unchecked
>> control indicates a null. In the past, when I manually saved the values
>> from the DTPs, I could save a null back to the database. But now, when I
>> uncheck a DTP and save, the originally saved date remains in the
>> database. If I change the value in the DTP (even if unchecked), the value
>> in the database changes.
>>
>> So what gives with the binding? How in the world to null a value from the
>> DTP when it is bound? Finally, who created this godforsaken control!?
>>

>
>



  Reply With Quote
Old 07-01-2007, 08:58 PM   #4
Earl
Guest
 
Posts: n/a
Default Re: The Infamous DateTimePicker

I worked that out by using the Value property -- with no need to add another
binding nor make changes to the BindingSource. Excellent resolution to a
tough annoying issue. Thanks much.

"Eric Moreau" <eric.moreau_N_O_S_P_A_M@videotron.ca> wrote in message
news:u01IWJnMHHA.5000@TK2MSFTNGP03.phx.gbl...
> see if an article I have written can answer your question :
> http://www.emoreau.com/Entries/Arti...er-control.aspx
>
> --
>
>
> HTH
>
> Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
> Conseiller Principal / Senior Consultant
> S2i web inc. (www.s2i.com)
> http://emoreau.s2i.com/
>
> "Earl" <brikshoe@newsgroups.nospam> wrote in message
> news:%23cVHCDnMHHA.780@TK2MSFTNGP03.phx.gbl...
>>I have what I consider to be an unusual issue. In the past, I've not used
>>data-binding with the DTPs. So I'm finding some of the old issues raising
>>their ugly heads in a new fashion.
>>
>> First a caveat: All other controls and data work properly on this form.
>> Updates, deletes, inserts, all as advertised. The DTPs are bound to
>> smalldatetime columns in the database. The bindingsource is bound to the
>> table, the controls to the bindingsource.
>>
>> The DTPs are set up as follows:
>> ShowCheckBox = True
>> Checked = True
>> Format = Short
>>
>> My understanding of the DTP in the past has been that an unchecked
>> control indicates a null. In the past, when I manually saved the values
>> from the DTPs, I could save a null back to the database. But now, when I
>> uncheck a DTP and save, the originally saved date remains in the
>> database. If I change the value in the DTP (even if unchecked), the value
>> in the database changes.
>>
>> So what gives with the binding? How in the world to null a value from the
>> DTP when it is bound? Finally, who created this godforsaken control!?
>>

>
>



  Reply With Quote
Old 22-01-2007, 03:26 AM   #5
=?Utf-8?B?Um9jazM=?=
Guest
 
Posts: n/a
Default Re: The Infamous DateTimePicker

Earl, so what did you do in order to resolve your problem?

"Earl" wrote:

> I worked that out by using the Value property -- with no need to add another
> binding nor make changes to the BindingSource. Excellent resolution to a
> tough annoying issue. Thanks much.
>
> "Eric Moreau" <eric.moreau_N_O_S_P_A_M@videotron.ca> wrote in message
> news:u01IWJnMHHA.5000@TK2MSFTNGP03.phx.gbl...
> > see if an article I have written can answer your question :
> > http://www.emoreau.com/Entries/Arti...er-control.aspx
> >
> > --
> >
> >
> > HTH
> >
> > Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
> > Conseiller Principal / Senior Consultant
> > S2i web inc. (www.s2i.com)
> > http://emoreau.s2i.com/
> >
> > "Earl" <brikshoe@newsgroups.nospam> wrote in message
> > news:%23cVHCDnMHHA.780@TK2MSFTNGP03.phx.gbl...
> >>I have what I consider to be an unusual issue. In the past, I've not used
> >>data-binding with the DTPs. So I'm finding some of the old issues raising
> >>their ugly heads in a new fashion.
> >>
> >> First a caveat: All other controls and data work properly on this form.
> >> Updates, deletes, inserts, all as advertised. The DTPs are bound to
> >> smalldatetime columns in the database. The bindingsource is bound to the
> >> table, the controls to the bindingsource.
> >>
> >> The DTPs are set up as follows:
> >> ShowCheckBox = True
> >> Checked = True
> >> Format = Short
> >>
> >> My understanding of the DTP in the past has been that an unchecked
> >> control indicates a null. In the past, when I manually saved the values
> >> from the DTPs, I could save a null back to the database. But now, when I
> >> uncheck a DTP and save, the originally saved date remains in the
> >> database. If I change the value in the DTP (even if unchecked), the value
> >> in the database changes.
> >>
> >> So what gives with the binding? How in the world to null a value from the
> >> DTP when it is bound? Finally, who created this godforsaken control!?
> >>

> >
> >

>
>
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off