delegate for handling the
BeforeNoteEdit event
This example demonstrates how to use the BeforeNoteEditEventArgs class' properties to only allow editing of Notes that fall on weekend days.
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 UltraMonthViewSingle1_BeforeNoteEdit(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinSchedule.BeforeNoteEditEventArgs) Handles ultraMonthViewSingle.BeforeNoteEdit
'----------------------------------------------------------------------------------------------------
' Description
' BeforeNoteEdit
'
' Fires before a Note's description is edited via the control's UI.
' If the event is canceled, the Note will not allow editing, and the AfterNoteEdit
' event does not fire.
'
'----------------------------------------------------------------------------------------------------
' Get the day of the week on which the Note falls
Dim dow As System.DayOfWeek = e.Note.Date.DayOfWeek
' If the Note falls on any other day than Saturday or Sunday,
' don't allow the edit
If dow <> System.DayOfWeek.Saturday And dow <> System.DayOfWeek.Sunday Then
MessageBox.Show("You do not have the appropriate permissions to edit this Note.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error)
e.Cancel = True
Return
End If
End Sub
private void ultraMonthViewSingle1_BeforeNoteEdit(object sender, Infragistics.Win.UltraWinSchedule.BeforeNoteEditEventArgs e)
{
//----------------------------------------------------------------------------------------------------
// Description
// BeforeNoteEdit
//
// Fires before a Note's description is edited via the control's UI.
// If the event is canceled, the Note will not allow editing, and the AfterNoteEdit
// event does not fire.
//
//----------------------------------------------------------------------------------------------------
// Get the day of the week on which the Note falls
System.DayOfWeek dow = e.Note.Date.DayOfWeek;
// If the Note falls on any other day than Saturday or Sunday,
// don't allow the edit
if ( dow != System.DayOfWeek.Saturday && dow != System.DayOfWeek.Sunday )
{
MessageBox.Show( "You do not have the appropriate permissions to edit this Note.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error );
e.Cancel = true;
return;
}
}
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