SetSelectedRange PowerScript function
Description
Sets the range of selected dates.
Controls
MonthCalendar control
Syntax
1 |
<span>controlname</span>.<span>SetSelectedRange </span>( <span>start</span>, <span>end</span> ) |
Argument |
Description |
---|---|
controlname |
The name of the MonthCalendar control |
start |
A date value to be set as the earliest |
end |
A date value to be set as the latest |
Return Values
Integer. Returns 0 for success and one
of the following negative values otherwise:
-
-1
Invalid arguments
-
-2
Unknown failure
Usage
Use the SetSelectedRange function to select
a range of consecutive dates.
SetSelectedRange uses the start date as
the end date and vice versa if you specify an end date that is earlier
than the start date. You must set the MaxSelectedCount property
to a value large enough to support the range before calling SetSelectedRange. SetSelectedRange returns
-1 if the dates you specify are outside the range of minimum and
maximum dates specified with SetDateLimits, or
if the range exceeds MaxSelectedCount. If the start and end dates
are the same, a single date is selected.
If the user scrolls the calendar with the navigation buttons
when a date range is selected, the date range changes as the calendar
scrolls.
SetSelectedDate and SetSelectedRange trigger
a DateChanged event. You should not call either method in a DateChanged
event, paticularly using the Post method.
Examples
This example sets the start date of the selected
range to startdate and the end date to enddate:
1 |
integer li_return<br>Date startdate, enddate<br>startdate = Today()<br>enddate = Date("12-31-2007")<br>li_return = mc_1.SetSelectedRange(startdate, enddate) |