Version

BeforeDropDown Event (UltraCalendarCombo)

Fired before the calendar is dropped down.
Syntax
'Declaration
 
Public Event BeforeDropDown As CancelEventHandler
public event CancelEventHandler BeforeDropDown
Event Data

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

PropertyDescription
Cancel  
Remarks

The BeforeDropDown event is fired before the calendar dropdown has been displayed but after it has been initialized. It can be used to prevent the dropdown from displaying. This can be done by setting the System.ComponentModel.CancelEventArgs.Cancel property to true.

Example
This example prevents the dropdown from being displayed when the current day is a Saturday or Sunday by setting the Cancel property of the event arguments to true.

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 UltraCalendarCombo1_BeforeDropDown(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ultraCalendarCombo1.BeforeDropDown

    '	The BeforeDropDown 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.

    '	Disallow the displaying of the dropdown calendar for weekend
    '	days by canceling the event if the current date is a Saturday
    '	or Sunday
    If (DateTime.Today.DayOfWeek = System.DayOfWeek.Saturday Or _
        DateTime.Today.DayOfWeek = System.DayOfWeek.Sunday) Then
        e.Cancel = True
    End If

End Sub
private void ultraCalendarCombo1_BeforeDropDown(object sender, System.ComponentModel.CancelEventArgs e)
{

	//	The BeforeDropDown 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.

	//	Disallow the displaying of the dropdown calendar for weekend
	//	days by canceling the event if the current date is a Saturday
	//	or Sunday
	if ( DateTime.Today.DayOfWeek == System.DayOfWeek.Saturday ||
		 	DateTime.Today.DayOfWeek == System.DayOfWeek.Sunday )
		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