I am looking for a month selector control for a .net 2 winform.
Use DateTimePicker
. You can use a custom format to enable just the month and year to be specified.
Example:
DateTimePicker dateTimePicker1 = new DateTimePicker();
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM yyyy";
dateTimePicker1.ShowUpDown = true; // to prevent the calendar from being displayed
See this MSDN article for more information.
Edit:
To prevent the calendar from being displayed, set the ShowUpDown
property on the DateTimePicker
to true
. This will prevent the calendar from being displayed and (in conjunction with a CustomFormat
) allow you to set just the month and year by using the up/down buttons.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With