Imports System.Diagnostics
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Private Sub GetYearInfo()
' Create a year object for the current year
Dim year As Infragistics.Win.UltraWinSchedule.Year = Me.ultraCalendarInfo1.GetYear(DateTime.Today.Year)
Dim info As String = String.Empty
' Display the number of the year
info += "The current year is " + year.YearNumber.ToString() + vbCrLf
' Display whether the year's Enabled property is true or false
If (year.Enabled) Then
info += "The year's Enabled property is set to true." + vbCrLf
Else
info += "The year's Enabled property is set to false." + vbCrLf
End If
' Display whether the year is effectively enabled
'
' Note that the EnabledResolved property accounts
' not only for the year's own Enabled property, but for the
' Enabled properties of all objects that constitute that year
' (i.e., Day, Month)
If (year.EnabledResolved) Then
info += "The year is enabled." + vbCrLf
Else
info += "The month is disabled." + vbCrLf
End If
' If there is activity, display the number of each type
If (year.HasActivity) Then
Dim activity As String = String.Empty
If (year.Appointments.Count > 0) Then
activity += year.Appointments.Count.ToString() + " Appointment(s)" + vbCrLf
End If
If (year.Holidays.Count > 0) Then
activity += year.Holidays.Count.ToString() + " Holiday(s)" + vbCrLf
End If
If (year.Notes.Count > 0) Then
activity += year.Notes.Count.ToString() + " Note(s)" + vbCrLf
End If
info += "There is activity for the year :" + vbCrLf
info += activity + vbCrLf
End If
' Display whether the year is a leap year
If (year.IsLeapYear) Then
info += "The current year is a leap year." + vbCrLf
Else
info += "The current year is not a leap year." + vbCrLf
End If
' Display the information
MessageBox.Show(info, "GetYearInfo")
End Sub