Version

Add(DateTime,String) Method

Creates and adds a new Appointment with the specified start date/time and subject and to the collection.
Syntax
'Declaration
 
Public Overloads Function Add( _
   ByVal startDateTime As Date, _
   ByVal subject As String _
) As Appointment
public Appointment Add( 
   DateTime startDateTime,
   string subject
)

Parameters

startDateTime
The StartDateTime of the new appointment.
subject
The Subject of the new appointment
Example
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.IO
Imports System.Globalization

    Private Sub AddAppointment(ByVal appointmentDate As DateTime, ByVal subject As String, ByVal fireEvents As Boolean)

        '	Determine whether the AfterAppointmentAdded event is enabled
        Dim beforeWasEnabled As Boolean = Me.ultraCalendarInfo1.EventManager.IsEnabled(CalendarInfoEventIds.BeforeAppointmentAdded)
        Dim afterWasEnabled As Boolean = Me.ultraCalendarInfo1.EventManager.IsEnabled(CalendarInfoEventIds.AfterAppointmentAdded)

        '	If the 'before' event was enabled, and the 'fireEvents' parameter is false,
        '	prevent the event from firing by disabling it
        If (beforeWasEnabled And Not fireEvents) Then
            Me.ultraCalendarInfo1.EventManager.SetEnabled(CalendarInfoEventIds.BeforeAppointmentAdded, False)
        End If

        '	If the 'after' event was enabled, and the 'fireEvents' parameter is false,
        '	prevent the event from firing by disabling it
        If (afterWasEnabled And Not fireEvents) Then
            Me.ultraCalendarInfo1.EventManager.SetEnabled(CalendarInfoEventIds.AfterAppointmentAdded, False)
        End If

        '	Add the appointment
        Me.ultraCalendarInfo1.Appointments.Add(appointmentDate, subject)

        '	Now re-enable the event firings, but only if they were not already disabled
        '	before this method was called.

        '	If the 'before' event was enabled, re-enable it now that we have added the appointment
        If (beforeWasEnabled And Not fireEvents) Then
            Me.ultraCalendarInfo1.EventManager.SetEnabled(CalendarInfoEventIds.BeforeAppointmentAdded, True)
        End If

        '	If the 'after' event was enabled, re-enable it now that we have added the appointment
        If (afterWasEnabled And Not fireEvents) Then
            Me.ultraCalendarInfo1.EventManager.SetEnabled(CalendarInfoEventIds.AfterAppointmentAdded, True)
        End If

    End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.IO;
using System.Globalization;

		private void AddAppointment( DateTime appointmentDate, string subject, bool fireEvents )
		{

			//	Determine whether the AfterAppointmentAdded event is enabled
			bool beforeWasEnabled = this.ultraCalendarInfo1.EventManager.IsEnabled( CalendarInfoEventIds.BeforeAppointmentAdded );
			bool afterWasEnabled = this.ultraCalendarInfo1.EventManager.IsEnabled( CalendarInfoEventIds.AfterAppointmentAdded );

			//	If the 'before' event was enabled, and the 'fireEvents' parameter is false,
			//	prevent the event from firing by disabling it
			if ( beforeWasEnabled && ! fireEvents )
				this.ultraCalendarInfo1.EventManager.SetEnabled( CalendarInfoEventIds.BeforeAppointmentAdded, false );
	
			//	If the 'after' event was enabled, and the 'fireEvents' parameter is false,
			//	prevent the event from firing by disabling it
			if ( afterWasEnabled && ! fireEvents )
				this.ultraCalendarInfo1.EventManager.SetEnabled( CalendarInfoEventIds.AfterAppointmentAdded, false );
	
			//	Add the appointment
			this.ultraCalendarInfo1.Appointments.Add( appointmentDate, subject );

			//	Now re-enable the event firings, but only if they were not already disabled
			//	before this method was called.

			//	If the 'before' event was enabled, re-enable it now that we have added the appointment
			if ( beforeWasEnabled && ! fireEvents )
				this.ultraCalendarInfo1.EventManager.SetEnabled( CalendarInfoEventIds.BeforeAppointmentAdded, true );
			
			//	If the 'after' event was enabled, re-enable it now that we have added the appointment
			if ( afterWasEnabled && ! fireEvents )
				this.ultraCalendarInfo1.EventManager.SetEnabled( CalendarInfoEventIds.AfterAppointmentAdded, true );
			
		}
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