How to select a Range of Dates in the MonthCalendar Control

MonthCalendar control provides us selection of the date range, however we can select a date in DateTimePicker but DateTimepicker enables the user to select a single DateTime value. But you can set a range of dates or get a selection range set by the user by using properties of the MonthCalendar control.
We can understand this with the help of following code sample that demonstrates how to set a selection range.


Private Sub SelectDateRange()
    Dim StartDate As Date = New DateTime(2011, 9, 21)
    Dim EndDate As Date = New DateTime(2011, 9, 25)
    MonthCalendar1.SelectionRange = New SelectionRange(StartDate, EndDate)
End Sub


private void SelectDateRange()
	System.DateTime StartDate = new DateTime(2011, 9, 21);
	System.DateTime EndDate = new DateTime(2011, 9, 25);
	MonthCalendar1.SelectionRange = new SelectionRange(StartDate, EndDate);

above code will select the daterange between 21/9/2011 to 25/9/2011.