This documentation is archived and is not being maintained.

MonthCalendar.SelectionRange Property

Gets or sets the selected range of dates for a month calendar control.

[Visual Basic]
Public Property SelectionRange As SelectionRange
[C#]
public SelectionRange SelectionRange {get; set;}
[C++]
public: __property SelectionRange* get_SelectionRange();
public: __property void set_SelectionRange(SelectionRange*);
[JScript]
public function get SelectionRange() : SelectionRange;
public function set SelectionRange(SelectionRange);

Property Value

A SelectionRange with the start and end dates of the selected range.

Exceptions

Exception Type Condition
ArgumentException The Start property value of the assigned SelectionRange is less than the minimum date allowable for a month calendar control.

-or-

The Start property value of the assigned SelectionRange is greater than the maximum allowable date for a month calendar control.

-or-

The End property value of the assigned SelectionRange is less than the minimum date allowable for a month calendar control.

-or-

The End property value of the assigned SelectionRange is greater than the maximum allowable date for a month calendar control.

Remarks

Setting this property is functionally equivalent to using the SetSelectionRange method. You can set the start and end dates separately by setting either SelectionStart or SelectionEnd.

If the Start property value of the SelectionRange is greater than its End property value, the dates are swapped; the End property value becomes the starting date, and Start property value becomes the end date.

Note   Scrolling the calendar display with the navigation buttons when a range is selected can cause unexpected results. For example, the date range is not preserved. If you have a single month displayed with a range of 04/01/2001 to 04/10/2001, scrolling the calendar to March changes the selected range as follows: 03/01/2001 to 03/10/2001. If you have multiple months displayed, such as March and April with a selected range of 04/01/2001 to 04/10/2001, scrolling the calendar back (to January and February) changes the selected range as follows: 01/01/2001 to 01/10/2001.

Requirements

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

MonthCalendar Class | MonthCalendar Members | System.Windows.Forms Namespace | SelectionRange | SelectionStart | SelectionEnd | SetSelectionRange

Show: