Version

OnVisibleMonthsChanged Method (UltraCalendarCombo)

Raises the VisibleMonthsChanged event after the UltraMonthViewMultiBase.VisibleMonths have been changed.
Syntax
'Declaration
 
Protected Overrides Sub OnVisibleMonthsChanged( _
   ByVal e As EventArgs _
) 
protected override void OnVisibleMonthsChanged( 
   EventArgs e
)

Parameters

e
A System.EventArgs that provides data for the event.
Remarks

Raising an event invokes the event handler through a delegate.

The OnVisibleMonthsChanged 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 OnVisibleMonthsChanged in a derived class, be sure to call the base class's OnVisibleMonthsChanged method so that registered delegates receive the event.

Example
This example displays the names of the new months being displayed by the control after the visible months have changed.

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_VisibleMonthsChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ultraMonthViewMulti1.VisibleMonthsChanged

    '	Display the new VisibleMonths to the user
    Dim info As String = String.Empty
    info += "The VisibleMonthsChanged event has fired. The new VisibleMonths are as follows:" + vbCrLf + vbCrLf
    Dim visibleMonth As Infragistics.Win.UltraWinSchedule.MonthViewMulti.VisibleMonth
    For Each visibleMonth In Me.ultraMonthViewMulti1.VisibleMonths
        '	Get the name of the visible month, append it to the string we will display
        Dim monthName As String
        monthName = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames(visibleMonth.Month.MonthNumber - 1)
        info += monthName + vbCrLf

    Next

    '	Display the message box
    MessageBox.Show(info, "VisibleMonthsChanged", MessageBoxButtons.OK)

End Sub
private void ultraMonthViewMulti1_VisibleMonthsChanged(object sender, System.EventArgs e)
{
		
	//	Display the new VisibleMonths to the user
	string info = string.Empty;
	info += "The VisibleMonthsChanged event has fired. The new VisibleMonths are as follows:" + "\n" + "\n";
	foreach ( Infragistics.Win.UltraWinSchedule.MonthViewMulti.VisibleMonth visibleMonth in this.ultraMonthViewMulti1.VisibleMonths )
	{
		//	Get the name of the visible month, append it to the string we will display
		string monthName = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames[ visibleMonth.Month.MonthNumber - 1 ];
		info += monthName + "\n";
		
	}

	//	Display the message box
	MessageBox.Show( info, "VisibleMonthsChanged", MessageBoxButtons.OK );

}
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