'Declaration Public Delegate Sub BeforeActivitiesDeletedEventHandler( _ ByVal sender As Object, _ ByVal e As BeforeActivitiesDeletedEventArgs _ )
public delegate void BeforeActivitiesDeletedEventHandler( object sender, BeforeActivitiesDeletedEventArgs e )
Private Sub UltraMonthViewSingle1_BeforeActivitiesDeleted(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinSchedule.BeforeActivitiesDeletedEventArgs) Handles ultraMonthViewSingle.BeforeActivitiesDeleted '---------------------------------------------------------------------------------------------------- ' Description ' BeforeActivitiesDeleted ' ' Fires before one or more Appointments or Notes are deleted via the control's UI. ' If the event is canceled, the activities are not deleted, and the AfterActivitiesDeleted event does not fire. ' '---------------------------------------------------------------------------------------------------- ' Set the DisplayPromptMsg property to false so that the control's ' default dialog is not displayed e.DisplayPromptMsg = False ' Since the control will remove all selected appointments and/or notes, get ' the number of selected appointments Dim selectedAppointmentCount As Integer = Me.ultraMonthViewSingle1.CalendarInfo.SelectedAppointments.Count ' If there were no selected Appointments, then the user is only deleting ' Notes, so we need not display a confirmation dialog. The 'Cancel' property ' of the event arguments defaults to false, so we can return now and the Notes ' will be deleted without a prompt. If selectedAppointmentCount = 0 Then Return ' Build the dialog string Dim info As String = String.Empty info += selectedAppointmentCount.ToString() + " Appointment(s) will be deleted." + vbCrLf info += "Choose Yes to delete the Appointments, or No to exit without deleting them." ' Display the custom dialog Dim result As DialogResult = MessageBox.Show(info, "Delete selected Appointments", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) ' If the user selected No, set the 'Cancel' property of the event arguments to true If result = DialogResult.No Then e.Cancel = True End Sub
private void ultraMonthViewSingle1_BeforeActivitiesDeleted(object sender, Infragistics.Win.UltraWinSchedule.BeforeActivitiesDeletedEventArgs e) { //---------------------------------------------------------------------------------------------------- // Description // BeforeActivitiesDeleted // // Fires before one or more Appointments or Notes are deleted via the control's UI. // If the event is canceled, the activities are not deleted, and the AfterActivitiesDeleted event does not fire. // //---------------------------------------------------------------------------------------------------- // Set the DisplayPromptMsg property to false so that the control's // default dialog is not displayed e.DisplayPromptMsg = false; // Since the control will remove all selected appointments and/or notes, get // the number of selected appointments int selectedAppointmentCount = this.ultraMonthViewSingle1.CalendarInfo.SelectedAppointments.Count; // If there were no selected Appointments, then the user is only deleting // Notes, so we need not display a confirmation dialog. The 'Cancel' property // of the event arguments defaults to false, so we can return now and the Notes // will be deleted without a prompt. if ( selectedAppointmentCount == 0 ) return; // Build the dialog string string info = string.Empty; info += selectedAppointmentCount.ToString() + " Appointment(s) will be deleted." + "\n"; info += "Choose Yes to delete the Appointments, or No to exit without deleting them."; // Display the custom dialog DialogResult result = MessageBox.Show( info, "Delete selected Appointments", MessageBoxButtons.YesNo, MessageBoxIcon.Warning ); // If the user selected No, set the 'Cancel' property of the event arguments to true if ( result == DialogResult.No ) e.Cancel = true; }
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