'Declaration Protected Overridable Sub OnBeforeNoteRemoved( _ ByVal e As CancelableNoteEventArgs _ )
protected virtual void OnBeforeNoteRemoved( CancelableNoteEventArgs e )
Raising an event invokes the event handler through a delegate.
The OnBeforeNoteRemoved 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 OnBeforeNoteRemoved in a derived class, be sure to call the base class's OnBeforeNoteRemoved method so that registered delegates receive the event.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics Private Sub ultraCalendarInfo1_BeforeNoteRemoved(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.CancelableNoteEventArgs) Handles ultraCalendarInfo1.BeforeNoteRemoved '---------------------------------------------------------------------------------------------------- ' Description ' BeforeNoteRemoved ' ' Fires before a note is removed from the component's Notes collection. ' If canceled, the Note is not removed, and the AfterNoteRemoved event does not fire. ' '---------------------------------------------------------------------------------------------------- ' If the count of the day's Notes collection is 1, this is the only note ' for that day, so disallow the removal, and inform the user. If (e.Note.Day.Notes.Count = 1) Then ' To prevent the removal of the Note, set the Cancel ' property to true e.Cancel = True ' Let the end user know what happened Dim info As String = String.Empty info += "The day must have at least one note." + vbCrLf MessageBox.Show(info, "BeforeNoteRemoved", MessageBoxButtons.OK, MessageBoxIcon.Warning) End If End Sub
using System.Diagnostics; using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void ultraCalendarInfo1_BeforeNoteRemoved(object sender, Infragistics.Win.UltraWinSchedule.CancelableNoteEventArgs e) { //---------------------------------------------------------------------------------------------------- // Description // BeforeNoteRemoved // // Fires before a note is removed from the component's Notes collection. // If canceled, the Note is not removed, and the AfterNoteRemoved event does not fire. // //---------------------------------------------------------------------------------------------------- // If the count of the day's Notes collection is 1, this is the only note // for that day, so disallow the removal, and inform the user. if ( e.Note.Day.Notes.Count == 1 ) { // To prevent the removal of the Note, set the Cancel // property to true e.Cancel = true; // Let the end user know what happened string info = string.Empty; info += "The day must have at least one note." + "\n"; MessageBox.Show( info, "BeforeNoteRemoved", MessageBoxButtons.OK, MessageBoxIcon.Warning ); } }
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