GetSelectedRange PowerScript function
Description
Retrieves the range of selected dates.
Controls
MonthCalendar control
Syntax
|
1 |
<span>controlname</span>.<span>GetSelectedRange </span>( <span>start</span>, <span>end</span> ) |
|
Argument |
Description |
|---|---|
|
controlname |
The name of the MonthCalendar control |
|
start |
A date value returned by reference that |
|
end |
A date value returned by reference that |
Return Values
Integer. Returns 0 for success, -1 if
only one date is selected, and -2 for an unknown failure.
Usage
If only one date is selected, GetSelectedRange returns
-1 and the selected date is retrieved in the start and end parameters.
Examples
This code in the DateChanged event prompts the user
to enter a second date after the first date in a range is entered,
and then asks the user to confirm the range selected:
|
1 |
date startdate, enddate<br>integer li_return<br> <br>li_return = mc_1.GetSelectedRange(startdate, enddate)<br>if li_return = -1 then<br>   MessageBox("Selected Dates",   &<br>      "Please select a return date")<br>elseif li_return = 0 then<br>   MessageBox("Selected Dates",   "You have selected "&<br>      + string(startdate) + " - " string(enddate) &<br>      + "~r~nClick OK to confirm")<br>else<br>   MessageBox("Selected Dates",   &<br>      "An error has occurred. Please reselect your " &<br>      + "travel dates")<br>end if |