Version

BeforeAppointmentEdit Event

Fired before an Appointment object is edited via the user interface.
Syntax
'Declaration
 
Public Event BeforeAppointmentEdit As BeforeAppointmentEditEventHandler
public event BeforeAppointmentEditEventHandler BeforeAppointmentEdit
Event Data

The event handler receives an argument of type BeforeAppointmentEditEventArgs containing data related to this event. The following BeforeAppointmentEditEventArgs properties provide information specific to this event.

PropertyDescription
Appointment Returns the appointment that is about to be edited
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Remarks

The BeforeAppointmentEdit event is a cancelable event. If the event is canceled, the corresponding Appointment object's in-place editor will not appear, and as such the BeforeAppointmentEdit event does not fire.

Example
This example demonstrates how to use the BeforeAppointmentEditEventArgs class' properties to only allow editing of single-day appointments 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_BeforeAppointmentEdit(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinSchedule.BeforeAppointmentEditEventArgs) Handles ultraMonthViewSingle.BeforeAppointmentEdit

    '----------------------------------------------------------------------------------------------------
    '	Description
    '	BeforeAppointmentEdit
    '
    '	Fires before an Appointment's subject is edited via the control's UI.
    '	If the event is canceled, the Appointment will not allow editing, and the AfterAppointmentEdit
    '	event does not fire.
    '
    '----------------------------------------------------------------------------------------------------

    '	Determine whether the appointment spans more than one day
    If e.Appointment.StartDateTime.Date <> e.Appointment.EndDateTime.Date Then

        '	This is a multi-day appointment, so we will inform the user that they do
        '	not have permission to edit the appointment, and cancel the event by
        '	setting the 'Cancel' property to true.
        MessageBox.Show("You do not have the appropriate permissions to edit this Appointment.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error)
        e.Cancel = True
        Return
    End If

    '	Get the day of the week on which the appointment falls
    Dim dow As System.DayOfWeek = e.Appointment.StartDateTime.DayOfWeek

    '	If the appointment 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 Appointment.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error)
        e.Cancel = True
        Return
    End If

End Sub
private void ultraMonthViewSingle1_BeforeAppointmentEdit(object sender, Infragistics.Win.UltraWinSchedule.BeforeAppointmentEditEventArgs e)
{		
	//----------------------------------------------------------------------------------------------------
	//	Description
	//	BeforeAppointmentEdit
	//
	//	Fires before an Appointment's subject is edited via the control's UI.
	//	If the event is canceled, the Appointment will not allow editing, and the AfterAppointmentEdit
	//	event does not fire.
	//
	//----------------------------------------------------------------------------------------------------

	//	Determine whether the appointment spans more than one day
	if ( e.Appointment.StartDateTime.Date != e.Appointment.EndDateTime.Date )
	{
		//	This is a multi-day appointment, so we will inform the user that they do
		//	not have permission to edit the appointment, and cancel the event by
		//	setting the 'Cancel' property to true.
		MessageBox.Show( "You do not have the appropriate permissions to edit this Appointment.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error );
		e.Cancel = true;
		return;
	}

	//	Get the day of the week on which the appointment falls
	System.DayOfWeek dow = e.Appointment.StartDateTime.DayOfWeek;

	//	If the appointment 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 Appointment.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error );
		e.Cancel = true;
		return;
	}

}
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