Version

GetHolidaysInRange Method

Returns a collection of Holiday objects that are at least partially in the specified date range.
Syntax
'Declaration
 
Public Function GetHolidaysInRange( _
   ByVal startDateTime As Date, _
   ByVal endDateTime As Date _
) As HolidaysSubsetCollection
public HolidaysSubsetCollection GetHolidaysInRange( 
   DateTime startDateTime,
   DateTime endDateTime
)

Parameters

startDateTime
Earliest start date for a holiday.
endDateTime
Latest end date for a holiday.

Return Value

An HolidaysSubsetCollection containing all the Holiday objects that overlap with the startDateTime and endDateTime.
Example
This example uses the GetAppointmentsInRange, GetHolidaysInRange, and GetNotesInRange methods to determine whether the current day has any appointments, holidays, or notes.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.IO
Imports System.Globalization

    Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

        '	Determine whether there is activity of each type for the current day by checking
        '	the count on the returned subset collection
        Dim hasAppointments As Boolean = Me.ultraCalendarInfo1.GetAppointmentsInRange(DateTime.Today.Date.AddHours(9.0F), DateTime.Today.Date.AddHours(9.5F)).Count > 0
        Dim hasHolidays As Boolean = Me.ultraCalendarInfo1.GetHolidaysInRange(DateTime.Today.Date, DateTime.Today.Date).Count > 0
        Dim hasNotes As Boolean = Me.ultraCalendarInfo1.GetNotesInRange(DateTime.Today.Date, DateTime.Today.Date).Count > 0

        '	Display the status on activities for the current day
        Dim info As String = String.Empty
        If (Not hasAppointments And Not hasHolidays And Not hasNotes) Then
            info += "There are no Appointments, Holidays, or Notes for " + DateTime.Today.ToLongDateString() + "." + vbCrLf
        Else

            If (hasAppointments) Then
                info += "There are Appointments scheduled for " + DateTime.Today.ToLongDateString() + "." + vbCrLf

                If (hasHolidays) Then
                    info += "There are Holidays that fall on " + DateTime.Today.ToLongDateString() + "." + vbCrLf

                    If (hasNotes) Then
                        info += "There are Notes for " + DateTime.Today.ToLongDateString() + "." + vbCrLf
                    End If
                End If
            End If
        End If

        MessageBox.Show(info, "GetAppointmentsInRange/GetHolidaysInRange/GetNotesInRange", MessageBoxButtons.OK)

    End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.IO;
using System.Globalization;

		private void button1_Click(object sender, System.EventArgs e)
		{
			
			//	Determine whether there is activity of each type for the current day by checking
			//	the count on the returned subset collection
			bool hasAppointments = this.ultraCalendarInfo1.GetAppointmentsInRange( DateTime.Today.Date.AddHours( 9.0F ), DateTime.Today.Date.AddHours( 9.5F ) ).Count > 0;
			bool hasHolidays = this.ultraCalendarInfo1.GetHolidaysInRange( DateTime.Today.Date, DateTime.Today.Date ).Count > 0;
			bool hasNotes = this.ultraCalendarInfo1.GetNotesInRange( DateTime.Today.Date, DateTime.Today.Date ).Count > 0;

			//	Display the status on activities for the current day
			string info = string.Empty;
			if ( ! hasAppointments && ! hasHolidays && ! hasNotes )
				info += "There are no Appointments, Holidays, or Notes for " + DateTime.Today.ToLongDateString() + "." + "\n";
			else
			{
				if ( hasAppointments )
					info += "There are Appointments scheduled for " + DateTime.Today.ToLongDateString() + "." + "\n";

				if ( hasHolidays )
					info += "There are Holidays that fall on " + DateTime.Today.ToLongDateString() + "." + "\n";

				if ( hasNotes )
					info += "There are Notes for " + DateTime.Today.ToLongDateString() + "." + "\n";
			}

			MessageBox.Show( info, "GetAppointmentsInRange/GetHolidaysInRange/GetNotesInRange", 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