Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim now As DateTime = DateTime.Now
' Create a TimeSpan that contains the same number of hours
' as the offset of the current time from midnight.
Dim offset As TimeSpan = TimeSpan.FromHours(now.Hour)
' Create a TimeSpan that contains the number of hours remaining
' in the current day, including the current hour.
Dim duration As TimeSpan = TimeSpan.FromHours((24 - now.Hour))
' Assign the offset to the UltraCalendarInfo's LogicalDayOffset
' property, so that the logical day begins on the current hour.
Me.ultraCalendarInfo1.LogicalDayOffset = offset
' Assign the duration to the UltraCalendarInfo's LogicalDayDuration property,
' so that the logical day ends at midnight of the following day.
Me.ultraCalendarInfo1.LogicalDayDuration = duration
End Sub