DatePicker.Value.Set Error binding to datasource

后端 未结 2 1285
再見小時候
再見小時候 2021-01-19 19:15

I have a bindingsource control called binding, on a form in VS2012, and a DateTimePicker control bound to it.

for the binding properties I have MinDate = 1/01/1753

相关标签:
2条回答
  • 2021-01-19 19:41

    The cause of the exception may be that the DatePicker's DataBinding "Value" property has been set to a BindingSource field. Only the DatePicker's DataBinding "Text" property needs to be set for the data binding to work correctly. Check if there is a value in the DatePicker's DataBinding "Value" property field, once removed the issue should go away.

    0 讨论(0)
  • 2021-01-19 19:41

    It seems that the key problem is the property is a Nullable DateTime. Probably the null value used to transcribe the DateTimePicker component is '1 / 01/0001 12:00:00 AM 'which creates a problem related to the configuration of MinValue and MaxValue. Using the Advanced tab of the DataBinding has an option to set the value to be used to null One way to solve this would be setting the value to null as MinDate, or we can set the MinDate with the value '01 / 01/0001 12:00 : 00 AM '. Despite my limited experience, I believe that this may be the source of your problems. the link http://msdn.microsoft.com/en-us/library/aa480734.aspx can see something else on the Advanced tab of the property DataBinding.

    0 讨论(0)
提交回复
热议问题