MonthCalendar.SelectionStart Property

Gets or sets the start date of the selected range of dates.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[<BrowsableAttribute(false)>]
member SelectionStart : DateTime with get, set

Property Value

Type: System.DateTime
A DateTime indicating the first date in the selection range.

ExceptionCondition
ArgumentOutOfRangeException

The date value is less than MinDate.

-or-

The date value is greater than MaxDate.

If you set the value of the SelectionStart property to a date that is later than the current value of the SelectionEnd property, SelectionEnd is automatically set equal to SelectionStart.

If you set a date in SelectionStart that causes the selection to exceed the number of days specified by the MaxSelectionCount property, the value of SelectionEnd is adjusted; SelectionEnd is automatically set so that the number of days selected is equal to MaxSelectionCount.

NoteNote

MaxSelectionCount represents the number of days in the selection, not the difference between SelectionStart and SelectionEnd. For example, if MaxSelectionCount is 7 (the default), then SelectionStart and SelectionEnd can be no more than six days apart.

NoteNote

Setting the SelectionRange for a MonthCalendar control that has visual styles enabled will result in the selection range not painting correctly on the control.

The following code example demonstrates how to use the SelectionStart and SelectionEnd properties. To run the example, paste the following code into a form containing a MonthCalendar control named MonthCalendar1, and call the ShowAWeeksVacationOneMonthFromToday method from the form's constructor or Load event-handling method.

No code example is currently available or this language may not be supported.
The following code example demonstrates how to use the MonthCalendar.SelectionStart and MonthCalendar.SelectionEnd properties.
To run the example, paste the following code in a form containing a MonthCalendar control named MonthCalendar1 and call the

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft