Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2007

Tip: Looking for answers? Try searching our database.

The Infamous DateTimePicker

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Earl - 07 Jan 2007 15:30 GMT
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!?
Eric Moreau - 07 Jan 2007 15:41 GMT
see if an article I have written can answer your question :
http://www.emoreau.com/Entries/Articles/2005/01/The-DateTimePicker-control.aspx

Signature

HTH

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

>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
[quoted text clipped - 19 lines]
> 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!?
Earl - 07 Jan 2007 20:19 GMT
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)

> see if an article I have written can answer your question :
> http://www.emoreau.com/Entries/Articles/2005/01/The-DateTimePicker-control.aspx
[quoted text clipped - 22 lines]
>> 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!?
Earl - 07 Jan 2007 20:58 GMT
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.

> see if an article I have written can answer your question :
> http://www.emoreau.com/Entries/Articles/2005/01/The-DateTimePicker-control.aspx
[quoted text clipped - 22 lines]
>> 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!?
Rock3 - 22 Jan 2007 03:26 GMT
Earl, so what did you do in order to resolve your problem?

> 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
[quoted text clipped - 26 lines]
> >> 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!?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.