Version

BeforeMonthScroll Event (UltraMonthViewMulti)

Fired before the MonthViewMulti control scrolls to a particular Month.
Syntax
'Declaration
 
Public Event BeforeMonthScroll As BeforeMonthScrollEventHandler
public event BeforeMonthScrollEventHandler BeforeMonthScroll
Event Data

The event handler receives an argument of type BeforeMonthScrollEventArgs containing data related to this event. The following BeforeMonthScrollEventArgs properties provide information specific to this event.

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
NewFirstMonth The month that will become the new first visible month in the control.
Remarks

The BeforeMonthScroll event may be canceled using System.ComponentModel.CancelEventArgs.Cancel property to prevent the control from scrolling.

The BeforeMonthScrollEventArgs.NewFirstMonth property returns the new Month object which will become the new UltraMonthViewMultiBase.FirstMonth. This property may also be set to a different month object to set the UltraMonthViewMultiBase.FirstMonth to a different Month object.

Example
This example cancels the event when the month being scrolled to does not fall in the current year.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Private Sub ultraMonthViewMulti1_BeforeMonthScroll(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinSchedule.BeforeMonthScrollEventArgs) Handles ultraMonthViewMulti1.BeforeMonthScroll

    '	The BeforeMonthScroll event is a "cancelable" event,
    '	which means that the action to which it corresponds can be
    '	prevented from happening by canceling the event.
    '	
    '	Canceling an event is very simple - just set the 'Cancel'
    '	property of the event arguments to true. The action will then
    '	be prevented from happening, and the corresponding "After"
    '	event will not fire.

    '	If the new first visible month is not in the current year,
    '	cancel the event
    If (e.NewFirstMonth.Year.YearNumber <> DateTime.Today.Year) Then
        e.Cancel = True
    End If

End Sub
private void ultraMonthViewMulti1_BeforeMonthScroll(object sender, Infragistics.Win.UltraWinSchedule.BeforeMonthScrollEventArgs e)
{

	//	The BeforeMonthScroll event is a "cancelable" event,
	//	which means that the action to which it corresponds can be
	//	prevented from happening by canceling the event.
	//	
	//	Canceling an event is very simple - just set the 'Cancel'
	//	property of the event arguments to true. The action will then
	//	be prevented from happening, and the corresponding "After"
	//	event will not fire.

	//	If the new first visible month is not in the current year,
	//	cancel the event
	if ( e.NewFirstMonth.Year.YearNumber != 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