Export (0) Print
Expand All

DateTimePicker.CalendarMonthBackground Property

Gets or sets the background color of the calendar month.

[Visual Basic]
Public Property CalendarMonthBackground As Color
public Color CalendarMonthBackground {get; set;}
public: __property Color get_CalendarMonthBackground();
public: __property void set_CalendarMonthBackground(Color);
public function get CalendarMonthBackground() : Color;
public function set CalendarMonthBackground(Color);

Property Value

A Color that represents the background color of the calendar month.


Exception Type Condition
ArgumentException The value assigned is a null reference (Nothing in Visual Basic).


When a DateTimePicker is created, this property is initially set equal to the DefaultMonthBackColor field value.


[Visual Basic, C#, C++] The following example demonstrates how to initialize the CalendarMonthBackground property. After creating a DateTimePicker and adding it to a Form, the example initializes the CalendarMonthBackground property to a Color constant.

[Visual Basic] 
Public Sub New()
   Dim dateTimePicker1 As New DateTimePicker()
   Controls.AddRange(New Control() {dateTimePicker1})
   dateTimePicker1.CalendarMonthBackground = Color.Aqua
End Sub 

public MyClass()
   DateTimePicker dateTimePicker1 = new DateTimePicker();
   Controls.AddRange(new Control[] {dateTimePicker1}); 
   dateTimePicker1.CalendarMonthBackground = Color.Aqua;

    MyClass() {
        DateTimePicker* dateTimePicker1 = new DateTimePicker();
        Control* myClassControls[] = {dateTimePicker1};
        dateTimePicker1->CalendarMonthBackground = Color::Aqua;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

DateTimePicker Class | DateTimePicker Members | System.Windows.Forms Namespace | DefaultMonthBackColor

© 2015 Microsoft