Version

CancelableNoteEventHandler Delegate

Delegate for handling the Cancelable event involving a single Note object.
Syntax
'Declaration
 
Public Delegate Sub CancelableNoteEventHandler( _
   ByVal sender As Object, _
   ByVal e As CancelableNoteEventArgs _
) 
public delegate void CancelableNoteEventHandler( 
   object sender,
   CancelableNoteEventArgs e
)

Parameters

sender
e
Example
This example uses the CancelableNoteEventArgs' Cancel property to disallow the addition of Notes to days that already have a Note associated with them, essentially restricting the number of Note objects that can be added to a day.

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.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics

    Private Sub ultraCalendarInfo1_BeforeNoteAdded(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.CancelableNoteEventArgs) Handles ultraCalendarInfo1.BeforeNoteAdded

        '----------------------------------------------------------------------------------------------------
        '	Description
        '	BeforeNoteAdded
        '
        '	Fires before a new note is added to the component's Notes collection.
        '	If canceled, the Note is not added, and the AfteNoteAdded event does not fire.
        '
        '----------------------------------------------------------------------------------------------------

        If (e.Note.Day.Notes.Count > 0) Then
            '	To prevent the addition 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 += "There is already a Note for " + e.Note.Day.Date.ToLongDateString() + vbCrLf
            info += "Please edit the existing note rather than create a new one."

            MessageBox.Show(info, "BeforeNoteAdded", MessageBoxButtons.OK)
        End If

    End Sub
using System.Diagnostics;
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;

		private void ultraCalendarInfo1_BeforeNoteAdded(object sender, Infragistics.Win.UltraWinSchedule.CancelableNoteEventArgs e)
		{		

			//----------------------------------------------------------------------------------------------------
			//	Description
			//	BeforeNoteAdded
			//
			//	Fires before a new note is added to the component's Notes collection.
			//	If canceled, the Note is not added, and the AfteNoteAdded event does not fire.
			//
			//----------------------------------------------------------------------------------------------------

			if ( e.Note.Day.Notes.Count > 0 )
			{
				//	To prevent the addition of the Note, set the Cancel
				//	property to true
				e.Cancel = true;

				//	Let the end user know what happened
				string info = string.Empty;
				info += "There is already a Note for " + e.Note.Day.Date.ToLongDateString() + ".\n";
				info += "Please edit the existing note rather than create a new one.";

				MessageBox.Show( info, "BeforeNoteAdded", 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