1

DateTimePicker for only month and year in windows application in .NET

I want to show only Month/Year DateTimePicker Control to provide UI to select any month of any year , but not date/day in windows application of .NET using C#.

Main requirement:

Only month and year need to be displayed in datepicker in windows

Guru Naidu
  • 11
  • 2
  • https://stackoverflow.com/q/5270089/17034 – Hans Passant Nov 03 '19 at 11:14
  • 1
    Possible duplicate of [How can i show month selection calendar in my app](https://stackoverflow.com/questions/5270089/how-can-i-show-month-selection-calendar-in-my-app) –  Nov 03 '19 at 11:52
  • I have the same problem. For a calendar app I need to display it using the years view opened by default to select birthday, so year next month then day. I try many things but nothing work. It seems there is no solution with the .NET Framework WinForms standard DatetimePicker. You need to create your own control or find an already created. I have not find one but I have not search a lot. –  Nov 03 '19 at 11:54

1 Answers1

0

Use DateTimerPicker.Format property. Check MSDN

public void SetCustomFormat()
{
    // Set the Format type and the CustomFormat string.
    dateTimePicker1.Format = DateTimePickerFormat.Custom;
    dateTimePicker1.CustomFormat = "MM/yyyy";
}
Marwen Jaffel
  • 703
  • 1
  • 6
  • 14