Version

OnAfterHolidayAdded Method

Raises the AfterHolidayAdded event before a Holiday is added to the Holidays collection.
Syntax
'Declaration
 
Protected Overridable Sub OnAfterHolidayAdded( _
   ByVal e As HolidayEventArgs _
) 
protected virtual void OnAfterHolidayAdded( 
   HolidayEventArgs e
)

Parameters

e
A HolidayEventArgs that provides data for the event.
Remarks

Raising an event invokes the event handler through a delegate.

The OnAfterHolidayAdded 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.

Holidays to Inheritors: When overriding OnAfterHolidayAdded in a derived class, be sure to call the base class's OnAfterHolidayAdded method so that registered delegates receive the event.

Example
This example displays information about the new Holiday after it is added.

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_AfterHolidayAdded(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.HolidayEventArgs) Handles ultraCalendarInfo1.AfterHolidayAdded

        '----------------------------------------------------------------------------------------------------
        '	Description
        '	AfterHolidayAdded
        '
        '	Fires after a new member is added to the component's Holidays collection
        '
        '----------------------------------------------------------------------------------------------------

        Dim info As String = String.Empty
        info += "A new Holiday was just added to the UltraCalendarInfo object:" + vbCrLf + vbCrLf
        info += "The new Holiday starts on: " + e.Holiday.StartDate.ToLongDateString() + vbCrLf
        info += "The new Holiday ends on: " + e.Holiday.StartDate.AddDays(e.Holiday.NumberOfDays).ToLongDateString() + vbCrLf

        info += "The new Holiday's Name is: " + e.Holiday.Name + vbCrLf
        info += "The new Holiday's will last for " + e.Holiday.NumberOfDays + " days." + vbCrLf

        MessageBox.Show(info, "AfterHolidayAdded", MessageBoxButtons.OK)

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

		private void ultraCalendarInfo1_AfterHolidayAdded(object sender, Infragistics.Win.UltraWinSchedule.HolidayEventArgs e)
		{		

			//----------------------------------------------------------------------------------------------------
			//	Description
			//	AfterHolidayAdded
			//
			//	Fires after a new member is added to the component's Holidays collection
			//
			//----------------------------------------------------------------------------------------------------
			
			string info = string.Empty;
			info += "A new Holiday was just added to the UltraCalendarInfo object:" + "\n\n";
			info += "The new Holiday starts on: " + e.Holiday.StartDate.ToLongDateString() + "\n";
			info += "The new Holiday ends on: " + e.Holiday.StartDate.AddDays( e.Holiday.NumberOfDays ).ToLongDateString() + "\n";

			info += "The new Holiday's Name is: " + e.Holiday.Name + "\n";
			info += "The new Holiday's will last for " + e.Holiday.NumberOfDays + " days." + "\n";
			
			MessageBox.Show( info, "AfterHolidayAdded", MessageBoxButtons.OK );

		}
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