'Declaration Public Event BeforeDropDown As CancelEventHandler
public event CancelEventHandler BeforeDropDown
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.
Property | Description |
---|---|
Cancel |
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.
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; }
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