468,161 Members | 1,972 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,161 developers. It's quick & easy.

Exception when databinding object with date to a datetimepicker.value

I have put a VS2005 sample project up here:
http://www.kevinandkiran.com/CSharpApplication.zip (its only 50k)

Basically I have a class that contains a date property, which is
initialised to 1/1/1970. I create a project datasource from this and
then drag my class onto my form which binds my property to a

However when I set the bindingsource to be an instance of my class at
runtime I get the following exception:
System.ArgumentOutOfRangeException: Value of '01/01/0001 00:00:00' is
not valid for 'Value'. 'Value' should be between 'MinDate' and
Parameter name: Value
at System.ComponentModel.ReflectPropertyDescriptor.Se tValue(Object
component, Object value)
at System.Windows.Forms.Binding.SetPropValue(Object value)
at System.Windows.Forms.Binding.PushData(Boolean force)

If I bind to the text property of the datetimepicker it works. But
this seems strange, why wont it bind to the Value property of the
datetimepicker? I have seen plenty of examples of this when binding
to a database table with DBNull values, but not to a business object
like mine.

Interestingly if I put a breakpoint on the get of the property it
doesnt stop until after the exception has been thrown.
Thanks in advance

Mar 21 '07 #1
1 2943
Also, the BindingComplete event seems to be called 4 times, even
though I am only binding one property. Does anyone know why this is

Mar 21 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Professor Frink | last post: by
9 posts views Thread by Ed Crowley | last post: by
reply views Thread by Richard | last post: by
2 posts views Thread by Richard | last post: by
2 posts views Thread by Jason MacKenzie | last post: by
3 posts views Thread by Sam | last post: by
3 posts views Thread by =?Utf-8?B?Q2hyaXM=?= | last post: by
reply views Thread by gcreed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.