Why you are calling this in the
ValueChanged
handler?
It might not work as expected because it is changed everytime the user changes one of the picker fields.
However, the error message is quite clear:
The passed date is after the actual
MaxDate
setting.
This can be avoided by setting
MinDate
first to
MinDateTime
, then
MaxDate
, and finally the new
MinDate
to be used:
dateTimePicker1.MinDate = DateTimePicker.MinDateTime;
dateTimePicker1.MaxDate = new DateTime(year+1,03,31);
dateTimePicker1.MinDate = new DateTime(year,04, 01);