How to display more than one month in the MonthCalendar Control


MonthCalendar windows form control provides us a graphical user interface to use and view a calendar. It contain all days name, month name and year. It provides us very comprehensive features of the calendar. By default it shows current month view but we can select a different month by clicking the arrow buttons on either side of the month caption.
Following is the default view of the MonthCalendar control:

Next is if you want to show more than one month in this control than you can use ClaendarDimensions property. Basically MonthCalendar control can display up to 12 months at a time means we can specify how many months are displayed and how they are arranged within the control with the help of CalendarDimensions property.

Suppose you want to display two months horizontally, set the Width to 2 and height to 1 in CalendarDimensions property.
[VB.Net]

MonthCalendar1.CalendarDimensions = New System.Drawing.Size(2, 1)
  1. <strong>[C#]</strong>
  2. <pre lang="cSharp">monthCalendar1.CalendarDimensions = new System.Drawing.Size (2,1);

Suppose you want to display two months vertically, set the Width to 1 and height to 2 in CalendarDimensions property.

[VB.Net]

MonthCalendar1.CalendarDimensions = New System.Drawing.Size(1, 2)
  1. <strong>[C#]</strong>
  2. <pre lang="cSharp">monthCalendar1.CalendarDimensions = new System.Drawing.Size (1,2);

Published by

Hirendra Sisodiya

Programmer at PSPL. Can be found on Google Plus.

  • Amanda

    How can you set a default for which month is the first displayed? I have 2 months displayed, and currently, it is defaulting to show last month and this month–but I want it to display this month and next month.

    • http://www.authorcode.com/ Hirendra Sisodiya

      HI Amanda..thank you for reading..

      By default the months will be displayed as current month than last month..until you set the following properties of the month control:

      RightToLeft : YES
      RightToLeftLayout: TRUE

      So change these above properties to set the default order to display the months.

      so please check this and let me know if you have any problem.

      thanks