Version

GetTimeSlotFromTime Method

Returns the TimeSlot object that contains the given time.
Syntax
'Declaration
 
Public Function GetTimeSlotFromTime( _
   ByVal time As Date _
) As TimeSlot
public TimeSlot GetTimeSlotFromTime( 
   DateTime time
)

Parameters

time
The time that must be contained in the TimeSlot object.

Return Value

TimeSlot object.
Remarks

Note: When the associated UltraCalendarInfo component's LogicalDayDuration property is set to a TimeSpan of less than 24 hours, this method can return null, as a TimeSlot that corresponds to the specified time might not exist.

Example
The following code demonstrates how to call the GetTimeSlotFromTime method of the UltraDayView control.

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

	Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

		Dim timeSlot As TimeSlot = Me.UltraDayView1.GetTimeSlotFromTime(New DateTime(1, 1, 1, 12, 15, 0))

		If Not timeSlot Is Nothing Then
			Debug.WriteLine("The TimeSlot that contains the time 12:15 starts at " + timeSlot.StartTime.ToLongTimeString() + " and ends at " + timeSlot.EndTime.ToLongTimeString())
		End If

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


		private void button2_Click(object sender, System.EventArgs e)
		{

			TimeSlot timeSlot = this.ultraDayView1.GetTimeSlotFromTime(new DateTime(1, 1, 1, 12, 15, 00));

			if (timeSlot != null)
				Debug.WriteLine("The TimeSlot that contains the time 12:15 starts at " + timeSlot.StartTime.ToLongTimeString() + " and ends at " + timeSlot.EndTime.ToLongTimeString());

		}
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