Work with a CALENDAR in WPF


I need to use a calendar and I can not set the following functions (in Cobol code):
- BlackoutDates = I used the command "invoke CalSaida::BlackoutDates::Add (new CalendarDateRange (new DateTime (01/01/2016), new DateTime (04/28/2016)))"
but gives nothing
What I want is to block the calendar as of yesterday.

- Selectdates (SelectionMode = "SingleRange") = I used the command "set wrk-reser to CalEntrada::SelectedDates" where wrk-reser is a "SelectedDatesCollection".
The variable-wrk reser has the start date and end date but I can not get.

I ask again for your help.


  • Hello,

    I've got for the command to work: "invoke CalSaida::BlackoutDates::Add(new CalendarDateRange(new DateTime(2016,05,15); new DateTime(2016,05,20)))"

    My problem now is to replace the constants (2016,05,15) by a variable as it has to be dynamic.


    Best Regards

    Alberto Ferraz

  • Verified Answer

    Something like this would work:

           01 StartDate.
              05 StartYear  pic 9(4)  value 2016.
              05 StartMonth pic 9(2)  value 05.
              05 StartDay   pic 9(2)  value 15.
           01 EndDate.
              05 EndYear  pic 9(4)  value 2016.
              05 EndMonth pic 9(2)  value 05.
              05 EndDay   pic 9(2)  value 20.
               declare myrange as type CalendarDateRange = New CalendarDateRange(new DateTime(StartYear, StartMonth, StartDay), new type DateTime(EndYear, EndMonth, EndDay))
               invoke myCalendar::BlackoutDates::Add(myRange)
           end method.
  • Hi Chris,

    Thanks again for your solution. It wroks good.

    Best regards

    Alberto Ferraz