'Declaration Protected Overridable Sub OnBeforeDropDown( _ ByVal e As CancelEventArgs _ )
protected virtual void OnBeforeDropDown( CancelEventArgs e )
Raising an event invokes the event handler through a delegate.
The OnBeforeDropDown 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 OnBeforeDropDown in a derived class, be sure to call the base class's OnBeforeDropDown method so that registered delegates receive the event.
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