My gut feeling on this is that your control has code to initialize the date
and time when the control is drawn, hence the reason binding to it invisible
doesn't work. .NET usually has not problem binding to 'controls' which are
not visible providing the control's are written properly. I'm not at all
being funny here, but when I'm stuck with a problem like this one I usually
ending reading the error message very very slowly and literally. In your
case, that indicates an invalid date so check the code in the control is
initializing the date without requiring the control to be drawn.
Hope that helps some,
--
--------------------------------------------------------
Peter Wright (
www.petewright.org)
Author of ADO.NET Novice To Pro
From Apress.
www.apress.com
"Marauderz" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> OK, I found the problem..
>
> It seems like at least in 1.0 of the framework, when you Databind to a
> control which is NOT visible. Databinding screws up bad. Can anyone
confirm
> this? I already have seen this exhibited in Labels, and DateTimePickers.
>
>
> "Marauderz" <(E-Mail Removed)> wrote in
message
> news:(E-Mail Removed)...
> > Hi, I have an object that implements IEditableObject that exposes a Date
> > property.
> >
> > A DateTimePicker on a form is bound to the property on the object.
> >
> > But when I call BindingContext.CancelCurrentEdit on it I get an error
that
> > says I'm trying to set an invalid date to the control a date of
01/01/0001
> > 12:00:00AM.
> >
> > Obviously something's wrong, I've stepped through the CancelEdit call on
> my
> > object, the member variables all have proper dates so I don't know how
> this
> > came to be, any suggestions?
> >
> > Thanks!
> >
> >
>
>