Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub SetupHoliday() ' Add a new holiday object to the component's Holidays collection, ' for the current date but as yet unnamed Dim holiday As Holiday = Me.ultraCalendarInfo1.Holidays.Add(DateTime.Today, String.Empty) ' Make sure we have the right starting date Debug.Assert((holiday.StartDate.Date = DateTime.Today.Date), "Error creating the holiday.") ' Set the name of the holiday to the long description of the ' day of the week it falls on holiday.Name = holiday.Day.DayOfWeek.LongDescriptionResolved ' Set the length of the holiday to one day holiday.NumberOfDays = 1 ' Make the holiday selected, and verify that the setting was applied holiday.Selected = True Debug.Assert(holiday.IsSelected, "Unable to set the holiday's Selected property to true.") ' Hide the holiday if there are any appointments for the same day If (holiday.Day.Appointments.Count > 0) Then holiday.Visible = False End If End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void SetupHoliday() { // Add a new holiday object to the component's Holidays collection, // for the current date but as yet unnamed Holiday holiday = this.ultraCalendarInfo1.Holidays.Add( DateTime.Today, string.Empty ); // Make sure we have the right starting date Debug.Assert( (holiday.StartDate.Date == DateTime.Today.Date), "Error creating the holiday." ); // Set the name of the holiday to the long description of the // day of the week it falls on holiday.Name = holiday.Day.DayOfWeek.LongDescriptionResolved; // Set the length of the holiday to one day holiday.NumberOfDays = 1; // Make the holiday selected, and verify that the setting was applied holiday.Selected = true; Debug.Assert ( holiday.IsSelected, "Unable to set the holiday's Selected property to true." ); // Hide the holiday if there are any appointments for the same day if ( holiday.Day.Appointments.Count > 0 ) holiday.Visible = false; }