SetSelection Action (MonthCalendar Controls)

Applies to TestComplete 15.64, last modified on May 16, 2024


Use the SetSelection action to select one or several dates in the month calendar control. If the control does not support multi-selection, the action selects only one date - the date specified by the First parameter. If the month calendar control supports multi-selection, SetSelection selects the specified range of dates in the calendar.


TestObj.SetSelection(First, Last)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
First [in]    Required    Date/Time    
Last [in]    Optional    Date/Time Default value:    
Result None

Applies To

The method is applied to the following object:

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.


The method has the following parameters:


Specifies the first date of the range to be selected if the control supports multi-selection. Otherwise this parameter specifies the date to be selected.


Specifies the last date of the range to be selected. If the control does not support multi-selection, Last is ignored.

Result Value



If Last is omitted, SetSelection modifies the selected range. After calling to SetSelection, wDate specifies the earliest date in the range, wEndDate - the latest date.

If First or Last is less than wMinDate or greater than wMaxDate, the selected range is not changed. The range is also not changed if the specified range is wider than the maximum range set for the control.


To view an example that demonstrates how to use the SetSelection action, see Setting MonthCalendar Date in Desktop Windows Applications.

See Also

Setting MonthCalendar Date in Desktop Windows Applications
wDate Property (Calendar Controls)
wEndDate Property (MonthCalendar Controls)
wMaxDate Property (Calendar Controls)
wMinDate Property (Calendar Controls)
wMultiSelect Property (MonthCalendar Controls)

Highlight search results