Retrieves the range of selected dates.
MonthCalendar control
controlname.GetSelectedRange ( start, end )
Argument |
Description |
---|---|
controlname |
The name of the MonthCalendar control for which you want to determine the range of selected dates |
start |
A date value returned by reference that indicates the earliest date selected when a range of dates has been selected |
end |
A date value returned by reference that indicates the latest date selected when a range of dates has been selected |
Integer. Returns 0 for success, -1 if only one date is selected, and -2 for an unknown failure.
If only one date is selected, GetSelectedRange returns -1 and the selected date is retrieved in the start and end parameters.
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:
date startdate, enddate integer li_return li_return = mc_1.GetSelectedRange(startdate, enddate) if li_return = -1 then MessageBox("Selected Dates", & "Please select a return date") elseif li_return = 0 then MessageBox("Selected Dates", "You have selected "& + string(startdate) + " - " string(enddate) & + "~r~nClick OK to confirm") else MessageBox("Selected Dates", & "An error has occurred. Please reselect your " & + "travel dates") end if