Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.IO
Imports System.Globalization
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
' 現在の年を取得します
Dim currentYear As Integer = DateTime.Today.Date.Year
' 現在のカルチャーのカレンダーに基づいて年の月数を取得します
Dim numberOfMonthsInYear As Integer = System.Globalization.CultureInfo.CurrentCulture.Calendar.GetMonthsInYear(currentYear)
' 年の最後の月にある日数を取得します
Dim month As Infragistics.Win.UltraWinSchedule.Month = Me.ultraCalendarInfo1.GetMonth(numberOfMonthsInYear, currentYear)
Dim numberOfDaysInMonth As Integer = month.DaysInMonth
' MinDate プロパティを現在の年の最初の日に設定します
Me.ultraCalendarInfo1.MinDate = New DateTime(currentYear, 1, 1)
' MaxDate プロパティを現在の年の最後の日に設定します
Me.ultraCalendarInfo1.MaxDate = New DateTime(currentYear, numberOfMonthsInYear, numberOfDaysInMonth)
End Sub