Version

BeforeHolidayRemoved Event

Fired before a Holiday is removed from the Holidays collection.
Syntax
'Declaration
 
Public Event BeforeHolidayRemoved As CancelableHolidayEventHandler
public event CancelableHolidayEventHandler BeforeHolidayRemoved
Event Data

The event handler receives an argument of type CancelableHolidayEventArgs containing data related to this event. The following CancelableHolidayEventArgs properties provide information specific to this event.

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Holiday Returns the Holiday associated with the event. This property is read-only.
Example
This example uses the CancelableHolidayEventArgs' Cancel property to disallow the removal of Holidays that span more than one day.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics

    Private Sub ultraCalendarInfo1_BeforeHolidayRemoved(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.CancelableHolidayEventArgs) Handles ultraCalendarInfo1.BeforeHolidayRemoved

        '----------------------------------------------------------------------------------------------------
        '	Description
        '	BeforeHolidayRemoved
        '
        '	Fires before a new holiday is removed from the component's Holidays collection.
        '	If canceled, the Holiday is not removed, and the AfterHolidayRemoved event does not fire.
        '
        '----------------------------------------------------------------------------------------------------

        If (e.Holiday.NumberOfDays > 1) 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 holidays." + vbCrLf

            MessageBox.Show(info, "BeforeHolidayRemoved", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If

    End Sub
using System.Diagnostics;
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;

		private void ultraCalendarInfo1_BeforeHolidayRemoved(object sender, Infragistics.Win.UltraWinSchedule.CancelableHolidayEventArgs e)
		{		

			//----------------------------------------------------------------------------------------------------
			//	Description
			//	BeforeHolidayRemoved
			//
			//	Fires before a new holiday is removed from the component's Holidays collection.
			//	If canceled, the Holiday is not removed, and the AfterHolidayRemoved event does not fire.
			//
			//----------------------------------------------------------------------------------------------------
		
			if ( e.Holiday.NumberOfDays > 1 )
			{
				//	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 holidays." + "\n";

				MessageBox.Show( info, "BeforeHolidayRemoved", MessageBoxButtons.OK, MessageBoxIcon.Error );
			}

		}
Requirements

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

See Also