Private Sub ultraCalendarCombo1_BeforeSpin(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.BeforeSpinEventArgs) Handles ultraCalendarCombo1.BeforeSpin
' Use the BeforeSpinEventArgs' CurrentValue property
' to determine the control's current value
If (Not e.CurrentValue Is Nothing) Then
Dim dateVal As DateTime = e.CurrentValue
Dim info As String = String.Empty
' Use the AfterSpinEventArgs' SpinDirection property
' to determine whether the up or down spin button was clicked
Dim spinUp As Boolean = True
If (e.SpinDirection = ScrollButton.Down) Then
spinUp = False
End If
' Use the NewDate property to determine what the date
' will be if the spin operation is not canceled
Dim newDate As DateTime = e.NewDate
' If the up spin button was clicked, and the new date would be
' outside the current year, cancel the spin operation by setting
' the Cancel property to true.
If (spinUp And newDate.Year <> DateTime.Today.Year) Then
e.Cancel = True
End If
End If
End Sub