Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics
Private Sub CreateLimitedRecurrences()
' The 'RangeLimit' is used to indicate what will
' determine when the last occurrence will occur.
' By default, this is set to NoLimit and is only
' limited by the MaxDate of the containing
' calendarinfo. When set to 'LimitByNumberOfOccurrences',
' the recurrence will be limited by the
' 'RangeMaxOccurrences' value. When set to
'
'
' The following recurrence is not limited
' other then by the max date of the associated
' calendar info.
'
Dim dt As DateTime = DateTime.Now
Dim dailyAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, dt.AddHours(3D), String.Empty)
' create the recurrence object - this appointment
' will become the rootappointment (or representation
' of the series) - it's 'IsRecurringAppointmentRoot'
' will return true and it will not displayed in
' the associated controls. instead, instances or
' occurrences of the recurrence will appear in the
' the controls associated with the calendar info.
dailyAppt.Recurrence = New AppointmentRecurrence()
' This will be a daily recurrence that will occur
' each weekday
dailyAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily
' In this case, we use the 'PatternDaysOfWeek' to
' indicate that the daily occurrences should fall
' on every weekday (each day but saturday and sunday).
dailyAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays
dailyAppt.Recurrence.RangeLimit = RecurrenceRangeLimit.NoLimit
' assign a subject [not required]
dailyAppt.Subject = "A daily activity that occurs every weekday with no limits"
' Another appointment with the same information
' that will end after 10 occurrences...
'
Dim dailyAppt2 As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, dt.AddHours(3D), String.Empty)
' create the recurrence object - this appointment
' will become the rootappointment (or representation
' of the series) - see above for more
dailyAppt2.Recurrence = New AppointmentRecurrence()
' This will be a daily recurrence that will occur
' each weekday
dailyAppt2.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily
' In this case, we use the 'PatternDaysOfWeek' to
' indicate that the daily occurrences should fall
' on every weekday (each day but saturday and sunday).
dailyAppt2.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays
' the RangeLimit here is used to indicate
' that it has a limited # of occurances but
' is not limited by date (other then the maxdate
' of the calendarinfo)
dailyAppt2.Recurrence.RangeLimit = RecurrenceRangeLimit.LimitByNumberOfOccurrences
' the 'RangeMaxOccurrences' is used to indicate
' the limiting number of occurrences.
dailyAppt2.Recurrence.RangeMaxOccurrences = 10
' assign a subject [not required]
dailyAppt2.Subject = "A daily activity that occurs every weekday for 10 occurrences"
' Another appointment with the same information
' that will end in 30 days
'
Dim dailyAppt3 As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, dt.AddHours(3D), String.Empty)
' create the recurrence object - this appointment
' will become the rootappointment (or representation
' of the series) - see above for more
dailyAppt3.Recurrence = New AppointmentRecurrence()
' This will be a daily recurrence that will occur
' each weekday
dailyAppt3.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily
' In this case, we use the 'PatternDaysOfWeek' to
' indicate that the daily occurrences should fall
' on every weekday (each day but saturday and sunday).
dailyAppt3.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays
' the RangeLimit here is used to indicate
' that no occurrences will occur after
' the specified end date
dailyAppt3.Recurrence.RangeLimit = RecurrenceRangeLimit.LimitByDate
' the 'RangeEndDate' is used to indicate
' the last possible date for an occurrence
dailyAppt3.Recurrence.RangeEndDate = dt.AddDays(30D)
' assign a subject [not required]
dailyAppt3.Subject = "A daily activity that occurs every weekday for the next 30 days"
End Sub