6
It is possible in the DateTimePicker
, disable the days before the current day?
6
It is possible in the DateTimePicker
, disable the days before the current day?
5
You can do this by adding the dates you want to MinDate
and MaxDate
, obviously the minimum can be the smallest valid date and the maximum the day of yesterday. Something like this:
this.dateTimePicker1.MaxDate = DateTime.Today.AddDays(-1);
this.dateTimePicker1.MinDate = DateTimePicker.MinimumDateTime;
I put in the Github for future reference.
The question changed midway but the answer remains the same as it changes the control but the properties MinDate
and MaxDate
are identical.
Browser other questions tagged c# .net winforms datetime
You are not signed in. Login or sign up in order to post.
Perfect bigown. I had put the monthCalendar, then fixed it for Datatimepicker, but it still worked its code. But when we click on the Datatimepicker, the date before the current day appears, disappearing only after we select a date. It may not appear when clicking on the Datatimepicker?
– user24136
I believe that not to be creating a control of its own, at least I found nothing that indicated this.
– Maniero
Right. Even so his tip worked bigown. When selecting an earlier date than the current date, he puts the current date and the previous days disappear. Thank you
– user24136