Version

GetClosestSelectableDay Method

Returns the closest enabled Day to the date specified.
Syntax
'Declaration
 
Public Function GetClosestSelectableDay( _
   ByVal date As Date, _
   ByVal direction As ClosestDayToReturn _
) As Day
public Day GetClosestSelectableDay( 
   DateTime date,
   ClosestDayToReturn direction
)

Parameters

date
DateTime to start the search.
direction
Enumeration specifying the direction of the search.

Return Value

A Day object for the closest enabled day or null (Nothing in VB) if no enabled day was found in the direction specified.
Example
This example uses the GetClosestSelectableDay method to get the Day object corresponding to the first selectable date (i.e., visible and enabled) that falls on or before the current date.

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

        '	Get the the first selectable day (i.e., visible and enabled) that
        '	falls on or before the current date
        Dim day As Infragistics.Win.UltraWinSchedule.Day
        day = Me.ultraCalendarInfo1.GetClosestSelectableDay(DateTime.Today, ClosestDayToReturn.OnOrBefore)

        '	Display the first selectable day to the end user
        If (Not day Is Nothing) Then
            MessageBox.Show("The first selectable day that falls on or before the current date is " + day.Date.ToLongDateString() + "." + vbCrLf, "GetClosestSelectableDay", MessageBoxButtons.OK)
        End If

    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)
		{

			//	Get the the first selectable day (i.e., visible and enabled) that
			//	falls on or before the current date
			Infragistics.Win.UltraWinSchedule.Day day = null;
			day = this.ultraCalendarInfo1.GetClosestSelectableDay( DateTime.Today, ClosestDayToReturn.OnOrBefore );

			//	Display the first selectable day to the end user
			if ( day != null )
				MessageBox.Show( "The first selectable day that falls on or before the current date is " + day.Date.ToLongDateString() + "." + "\n", "GetClosestSelectableDay", 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