DateTimePicker Option to select only certain days of the week

I need to be able to select only certain days of the week from a DateTimePicker. I would like to know if it is possible to get the user to select any day from MON-FRI and just disable SAT and SUN. I can understand that I can create pre-selection events that will pop up with a message telling the user to reselect their days. I wanted to see if there is a way to automatically disable SAT and SUN, and just select the user only any day from MON-FRI.

+4
source share
1 answer

There are no built-in functions for DateTimePicker to limit dates beyond the range of choices when starting and ending date pickers. (IE, you cannot block dates that fall "inside" this range.)

Instead, you will either have to use the alternative (and some are free to use), or check the date in the Validate event, and if it is not valid according to your date rules, reset the date and enter the error.

+4
source

Source: https://habr.com/ru/post/1384777/


All Articles