MultiSelect returns or sets a value that determines if multiple dates can be selected at once. MaxSelCount returns or sets the maximum number of contiguous days that can be selected at once. SelEnd and SelStart returns or sets the upper and lower bounds of the date range that is selected.
object.MultiSelect [= boolean]
object.MaxSelCount [= number%]
object.SelEnd [= date]
object.SelStart [= date]
object: MonthView
date:Date exp
The MultiSelect property allows the user to select multiple days (True = Default). When set to False, the user is not allowed to select multiple days. By default, the control allows the user to select a range of dates. The default maximum range is one week (7 days). You can change the maximum selectable range by setting the MaxSelCount property. The Value property will be in this range, indicating which date has focus.
The MaxSelCount property is valid only when the MultiSelect property is to True. Additionally, the MaxSelCount property must be set to a value that is greater than the difference between the SelStart and SelEnd properties. For example, given a selection of 9/15 to 9/18, MonthView.SelEnd - MonthView.SelStart = 3. However, four days are actually selected; thus MaxSelCount must be set to 4. The default of the property is one week (7 days).
The SelStart property defines the lower bound of the date range that is selected. The SelEnd property defines the upper bound of the date range that is selected.
The range of selected dates can span multiple months. It can include dates that are not currently displayed.
In order for multiple date selection to work properly, the MaxSelCount property must be set to a value that is greater than the difference between the SelStart and SelEnd properties.
The SelStart and SelEnd settings are only valid if the MultiSelect property is set to True. In addition, if the date range you are trying to select is not visible then an error will be raised - to get around this, set Value first to show the required month (or months if you have more than one shown) and then enter the values to define the required selection.
// This example highlights the week encompassing the selected date...
// ...running from Sunday to Saturday
Ocx MonthView mvw : mvw.MultiSelect = True
Do : Sleep : Until Me Is Nothing
Sub mvw_MouseUp(Button&, Shift&, x!, y!)
Local dateclicked As Date = mvw.Value, wd| = WeekDay(dateclicked), se As Date, ss As Date
se = DateAdd("d", -(wd| - 1), dateclicked) // Find preceding Sunday
ss = DateAdd("d", (7 - wd|), dateclicked) // Find next Saturday
Trace wd| : Trace dateclicked : Trace se : Trace ss
mvw.Value = ss : mvw.SelStart = ss : mvw.SelEnd = se
EndSub
{Created by Sjouke Hamstra; Last updated: 20/10/2014 by James Gaite}