Reputation: 61
Is it possible to restrict DateTimePicker
only by year choices when dropping down the calendar?
Upvotes: 1
Views: 648
Reputation: 39946
Do the following steps:
Change the property of the DateTimePicker
's Format
to Custom
like this:
dateTimePicker1.Format = DateTimePickerFormat.Custom;
Change the CustomFormat
to yyyy
like this:
dateTimePicker1.CustomFormat = "yyyy";
Set the ShowUpDown
property to true
or false
as you want like this:
dateTimePicker1.ShowUpDown = true;
Upvotes: 1