Version

OnBeforeSpin Method

Raises the BeforeSpin event before the Value property has been changed via a spin button or arrow key.
Syntax
'Declaration
 
Protected Overridable Sub OnBeforeSpin( _
   ByVal e As BeforeSpinEventArgs _
) 
protected virtual void OnBeforeSpin( 
   BeforeSpinEventArgs e
)

Parameters

e
A BeforeSpinEventArgs that provides data for the event.
Remarks

Raising an event invokes the event handler through a delegate.

The OnBeforeSpin method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Notes to Inheritors: When overriding OnBeforeSpin in a derived class, be sure to call the base class's OnBeforeSpin method so that registered delegates receive the event.

Example
NOTE: This example requires that the control's SpinButtonsVisible property be set to true, like so:
Me.ultraCalendarCombo1.SpinButtonsVisible = True
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
NOTE: This example requires that the control's SpinButtonsVisible property be set to true, like so:
this.ultraCalendarCombo1.SpinButtonsVisible = true;
private void ultraCalendarCombo1_BeforeSpin(object sender, Infragistics.Win.UltraWinSchedule.BeforeSpinEventArgs e)
{

	//	Use the BeforeSpinEventArgs' CurrentValue property
	//	to determine the control's current value
	if ( e.CurrentValue is System.DateTime )
	{
		DateTime dateVal = (DateTime)(e.CurrentValue);
		string info = string.Empty;


		//	Use the AfterSpinEventArgs' SpinDirection property
		//	to determine whether the up or down spin button was clicked
		bool spinUp = true;
		if ( e.SpinDirection == ScrollButton.Down )
			spinUp = false;
		
		//	Use the NewDate property to determine what the date
		//	will be if the spin operation is not canceled
		DateTime newDate = 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 && newDate.Year != DateTime.Today.Year )
			e.Cancel = true;
	}		
 
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also