Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics
Private Sub ultraCalendarInfo1_BeforeDisplayAppointmentRecurrenceDialog(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.DisplayAppointmentRecurrenceDialogEventArgs) Handles ultraCalendarInfo1.BeforeDisplayAppointmentRecurrenceDialog
' The 'BeforeDisplayAppointmentRecurrenceDialog' event is
' invoked from the built in UltraWinSchedule appointment
' dialog when the Recurrence button is pressed and provides
' an opportunity to prevent the dialog from being displayed
' or modify what may be done.
'
' the 'IsExistingRecurrence' parameter indicates if the appointment
' originally was part of a recurrence
If Not e.IsExistingRecurrence Then
' the 'Cancel' parameter can be used to prevent the dialog
' from being displayed. in this case, we will not allow
' new recurrences to be created.
e.Cancel = True
Else
Dim recurrence As AppointmentRecurrence
' get the recurrence - this should be available
' since this block will only be executed if the
' 'IsExistingRecurrence' is true
If e.Appointment.IsRecurringAppointmentRoot Then
recurrence = e.Appointment.Recurrence
Else
recurrence = e.Appointment.RecurringAppointmentRoot.Recurrence
End If
' by default, a recurrence is allowed to continue without
' a limit (see AppointmentRecurrence.RangeLimit) but the
' 'AllowNoEndDate' parameter can be used to prevent the user
' from being able to specify that the recurrence has no end date.
'
' if the appointment recurrence was created with a limit
' do not allow the user to set this to not have a limit
If recurrence.RangeLimit <> RecurrenceRangeLimit.NoLimit Then
e.AllowNoEndDate = False
End If
End If
End Sub