Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

looking for a month/year selector control for .net winform

Tags:

c#

.net

winforms

I am looking for a month selector control for a .net 2 winform.

like image 453
Brad Avatar asked Oct 22 '09 17:10

Brad


1 Answers

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.

like image 197
Donut Avatar answered Oct 18 '22 14:10

Donut