-
Oct 3rd, 2015, 10:39 AM
#1
Thread Starter
Addicted Member
Date time picker problem
Hello,
I tried to find a solution, but wasn't able to find one that solved my problem.
I have a form with several date time pickers. On loading this form the program throws the error below. I can click "continue" and the program continues without an errors. However it is an anoying problem i want to get rid of.
Additional information: '01/01/0001 00:00:00' is not a valid value for
'Value'. 'Value' should be between 'MinDate' and 'MaxDate'.
I tried to set the Custom format
Code:
dateTimePicker.Format = DateTimePickerFormat.Custom;
dateTimePicker.CustomFormat = "dd/MM/yy";
But this didn't solve the error anyone a tip on this error.
-
Oct 3rd, 2015, 01:17 PM
#2
Re: Date time picker problem
Well the error is pretty simple... you're setting it to a date that is outside of the min and max values... format has nothign to do with the issue. Are you setting the .Value of the DTP at any point?
-tg
-
Oct 3rd, 2015, 03:25 PM
#3
Re: Date time picker problem
Also, are you setting the min or max values in the designer? After all, if you set a valid date range, which you can do while designing the form, then you'd need to make sure that the date that is being displayed falls within that range.
It does kind of sound like you are at least setting a default value, though, because I believe that the DTP defaults to using the current date if you don't explicitly set it to something else, and you certainly aren't getting the current date in that error message.
My usual boring signature: Nothing
-
Oct 4th, 2015, 01:33 PM
#4
Thread Starter
Addicted Member
Re: Date time picker problem
I tried to set the min. and max. date on the DTP in the properties. This doesn't work, the system does not allow me to have a "MinDate" below 01/01/1753. I tried to set the .value in the properties, and by code to today "Now" this doesn't work either.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|