Back to Devexpress

Appointment.GetOccurrence(Int32) Method

corelibraries-devexpress-dot-xtrascheduler-dot-appointment-dot-getoccurrence-x28-system-dot-int32-x29.md

latest4.3 KB
Original Source

Appointment.GetOccurrence(Int32) Method

Gets an occurrence at the specified position within a series of recurring appointments.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.Core.dll

NuGet Package : DevExpress.Scheduler.Core

Declaration

csharp
Appointment GetOccurrence(
    int recurrenceIndex
)
vb
Function GetOccurrence(
    recurrenceIndex As Integer
) As Appointment

Parameters

NameTypeDescription
recurrenceIndexInt32

A zero-based integer which identifies the index of an occurrence in the series of recurring appointments.

|

Returns

TypeDescription
Appointment

An Appointment object which is an occurrence at the specified position.

|

Remarks

An appointment of the AppointmentType.Pattern type starts the series of recurring appointments. Each occurrence in the series is identified by a zero-based recurrence index specified by the Appointment.RecurrenceIndex property.

The GetOccurrence method allows you to get an occurrence at the specified position. If an occurrence at the specified position has been modified, the GetOccurrence method returns the modified occurrence (appointment exception). If an occurrence at the specified position is deleted, the GetOccurrence method returns null.

Note

If the current appointment is not a patten (its Appointment.Type is not AppointmentType.Pattern), then the ArgumentException exception is thrown.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetOccurrence(Int32) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-scheduler-create-appointments-on-reminder-alert/CS/ReminderCustomActions/Form1.cs#L120

csharp
if (apt != null && apt.IsRecurring) {
    Appointment nextOcc = apt.RecurrencePattern.GetOccurrence(apt.RecurrenceIndex + 1);
    memoEdit1.Text = "The next occurrence has index " + nextOcc.RecurrenceIndex + " and Price=" + nextOcc.CustomFields["CustomPrice"]

winforms-scheduler-create-appointments-on-reminder-alert/VB/ReminderCustomActions/Form1.vb#L124

vb
If apt IsNot Nothing AndAlso apt.IsRecurring Then
    Dim nextOcc As Appointment = apt.RecurrencePattern.GetOccurrence(apt.RecurrenceIndex + 1)
    memoEdit1.Text = "The next occurrence has index " & nextOcc.RecurrenceIndex & " and Price=" & nextOcc.CustomFields("CustomPrice").ToString() & vbCrLf

See Also

Appointment Interface

Appointment Members

DevExpress.XtraScheduler Namespace