Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub DisableFirstAndLastDayOfYear() ' Get a DayOfYear object for the first day of the year ' Note that the DaysOfYear collection is one-based so as ' to be more intuitive to use Dim dayOfYear As Infragistics.Win.UltraWinSchedule.DayOfYear dayOfYear = Me.ultraCalendarInfo1.DaysOfYear(1) ' Assert that we got the one we expected Debug.Assert(dayOfYear.DayNumber = 1, "Wrong DayOfYear returned in 'DisableFirstAndLastDayOfYear'!") ' Disable the first day of the year If (dayOfYear.DayNumber = 1) Then dayOfYear.Enabled = False End If ' Get a DayOfYear object for the first day of the year... ' Since the last day is day 366 during a leap year, and the ' DayOfYear object is independent of a particular year, we ' will the use the indexer into the DaysOfYear collection that ' takes a month and a day, since we know that December 31 ' is the last day of the year dayOfYear = Me.ultraCalendarInfo1.DaysOfYear(12, 31) ' Disable the last day of the year dayOfYear.Enabled = False End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void DisableFirstAndLastDayOfYear() { // Get a DayOfYear object for the first day of the year // Note that the DaysOfYear collection is one-based so as // to be more intuitive to use Infragistics.Win.UltraWinSchedule.DayOfYear dayOfYear; dayOfYear = this.ultraCalendarInfo1.DaysOfYear[ 1 ]; // Assert that we got the one we expected Debug.Assert( dayOfYear.DayNumber == 1, "Wrong DayOfYear returned in 'DisableFirstAndLastDayOfYear'!" ); // Disable the first day of the year if ( dayOfYear.DayNumber == 1 ) dayOfYear.Enabled = false; // Get a DayOfYear object for the first day of the year... // Since the last day is day 366 during a leap year, and the // DayOfYear object is independent of a particular year, we // will the use the indexer into the DaysOfYear collection that // takes a month and a day, since we know that December 31 // is the last day of the year dayOfYear = this.ultraCalendarInfo1.DaysOfYear[ 12, 31 ]; // Disable the last day of the year dayOfYear.Enabled = false; }