Hi William,
I had a similar job to do for one of our customers. It was not a third party calendar, but the .net native System.Windows.MonthCalendar, on which we needed to show working days and the days worked, for each plant, on a set of 4 months at a time.
Of course, working days and days worked are retrieved in a BO, and there is no databinding enabled for this control...
The ParentFormLoading Event is the right place to code, the controls are already created (this event is more similar to the init VFP event, than to the load VFP event).
here is some code:
Private Sub BO_JoursTravailSites_ParentFormLoading() Handles BO_JoursTravailSites.ParentFormLoading
Dim andeb As Integer = Today.Year - 5
Dim anfin As Integer = Today.Year + 10
Me.BO_JoursTravailSites.FillJoursTravail(andeb, anfin, "")
' définir la plage du calendrier sur les dates maxi et mini du BO
' let's define the calendar's range from the min and max dates in the BO
Me.MonthCalendar.MinDate = DateValue("01/01/" & andeb.ToString)
Me.MonthCalendar.MaxDate = DateValue("31/12/" & anfin.ToString)
' sur cette plage, mettre en gras les week-ends et jours fériés
' on this range, display in BOLD weekends and holidays
With Me.BO_JoursTravailSites
If .MoveFirst() Then
Do
If .WeekEnd = True _
Or .JourFerie = True Then
Me.MonthCalendar.AddBoldedDate(.DateJour)
End If
Loop While .MoveNext()
End If
End With
End Sub
When a date is selected on the calendar, I run some code to add a check in a list.
Private Sub MonthCalendar_DateSelected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) _
Handles MonthCalendar.DateSelected
Me.ActualiseListeSites(e.Start)
End Sub
the ActualiseListeSites is pretty identic as the code above. I put a filter on the BO based on the value received in the parameter, and then I process a scan/endscan in a loop.