![]() Gravitybox Schedule.NET
1998-2005 Gravitybox Software LLC
Page 59 of 90
You may also choose to recur based on an ordinal position in a month like the second
Tuesday of each fourth month. The following code snippet demonstrates this
configuration.
Dim appointment As Appointment
appointment = Schedule1.AppointmentCollection.Add("", _
#6/6/2005#, #8:00:00 AM#, 60)
appointment.Subject = "John Doe"
'Create and setup the recurrence
Dim recurrence As New Recurrence
'End the recurrence by interval after 3 appointments added
'and on this date
recurrence.StartDate = appointment.StartDate
recurrence.EndType = RecurrenceEndConstants.recEndByInterval
recurrence.EndIterations = 3
recurrence.RecurrenceInterval = RecurrenceIntervalConstants.ricMonthly
'Setup the RecurrenceDay object
'Add an appointment the second(2) Tuesday every 4 months
recurrence.RecurrenceMonth.MonthInterval = 4
recurrence.RecurrenceMonth.RecurrenceMode = _
RecurrenceMonthConstants.MonthOrdinal
recurrence.RecurrenceMonth.DayOrdinal = _
RecurrenceMonthOrdinalConstants.Second
recurrence.RecurrenceMonth.DayPosition = _
RecurrenceMonthOrdinalDayConstants.Tuesday
'Add the recurrence
Schedule1.AppointmentCollection.AddRecurrence(appointment, recurrence)
As you can see, the recurrence objects are a bit complicated but they give you great
flexibility. You can create virtually any recurrence scenario that you can conceive. The
most important fact to remember is that each appointment is a separate, distinct
appointment in and of itself and they all share the same RecurrenceId.
|