'Declaration Protected Overridable Sub OnBeforeAppointmentRemoved( _ ByVal e As CancelableAppointmentEventArgs _ )
protected virtual void OnBeforeAppointmentRemoved( CancelableAppointmentEventArgs e )
Raising an event invokes the event handler through a delegate.
The OnBeforeAppointmentRemoved method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Notes to Inheritors: When overriding OnBeforeAppointmentRemoved in a derived class, be sure to call the base class's OnBeforeAppointmentRemoved method so that registered delegates receive the event.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics Private Sub ultraCalendarInfo1_BeforeAppointmentRemoved(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.CancelableAppointmentEventArgs) Handles ultraCalendarInfo1.BeforeAppointmentRemoved '---------------------------------------------------------------------------------------------------- ' Description ' BeforeAppointmentRemoved ' ' Fires before an appointment is removed from the component's Appointments collection. ' If canceled, the Appointment is not removed, and the AfterAppointmentRemoved event does not fire. ' '---------------------------------------------------------------------------------------------------- ' Get the Appointment's starting and ending dates, and ' determine whether it spans more than one day Dim startDate As DateTime = e.Appointment.StartDateTime.Date Dim endDate As DateTime = e.Appointment.StartDateTime.Date If (endDate > startDate) Then ' To prevent the removal of the Appointment, set the Cancel ' property to true e.Cancel = True ' Let the end user know what happened Dim info As String = String.Empty info += "You do not have sufficient permissions to remove multi-day appointments." + vbCrLf MessageBox.Show(info, "BeforeAppointmentRemoved", MessageBoxButtons.OK, MessageBoxIcon.Error) End If End Sub
using System.Diagnostics; using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void ultraCalendarInfo1_BeforeAppointmentRemoved(object sender, Infragistics.Win.UltraWinSchedule.CancelableAppointmentEventArgs e) { //---------------------------------------------------------------------------------------------------- // Description // BeforeAppointmentRemoved // // Fires before an appointment is removed from the component's Appointments collection. // If canceled, the Appointment is not removed, and the AfterAppointmentRemoved event does not fire. // //---------------------------------------------------------------------------------------------------- // Get the Appointment's starting and ending dates, and // determine whether it spans more than one day DateTime startDate = e.Appointment.StartDateTime.Date; DateTime endDate = e.Appointment.StartDateTime.Date; if ( endDate > startDate ) { // To prevent the removal of the Appointment, set the Cancel // property to true e.Cancel = true; // Let the end user know what happened string info = string.Empty; info += "You do not have sufficient permissions to remove multi-day appointments." + "\n"; MessageBox.Show( info, "BeforeAppointmentRemoved", MessageBoxButtons.OK, MessageBoxIcon.Error ); } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2