Version

PatternOccurrenceOfDayInMonth Property (AppointmentRecurrence)

Gets/sets whether the recurrence should occur on the first, second, third, fourth or last occurrence of the day of the week (corresponding to the value of the PatternDaysOfWeek property) in its respective month.
Syntax
'Declaration
 
Public Overrides Property PatternOccurrenceOfDayInMonth As RecurrencePatternOccurrenceOfDayInMonth
public override RecurrencePatternOccurrenceOfDayInMonth PatternOccurrenceOfDayInMonth {get; set;}
Remarks

Note: The PatternOccurrenceOfDayInMonth property is only applicable when the PatternFrequency property is set to 'Monthly' or 'Yearly'.

Example
The following examples demonstrates how to use the 'PatternOccurrenceOfDayInMonth' to create calculated monthly and yearly recurring appointments.

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

    Private Sub CreateCalculatedMonthlyAndYearlyAppointments()
        ' The 'PatternOccurrenceOfDayInMonth' is used by
        ' calculated monthly and yearly (see PatternFrequency)
        ' recurrences.
        '

        ' For a calculated monthly recurrence, the 
        ' 'PatternOccurrenceOfDayInMonth' is used in conjuction with 
        ' the 'PatternInterval' and 'PatternDaysOfWeek' to 
        ' determine which day of the month will be the start 
        ' of each occurrence
        '

        ' create a new appointment
        Dim dt As DateTime = DateTime.Now
        Dim mthAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, dt.AddHours(3D), String.Empty)

        ' create the recurrence object - this appointment
        ' will become the rootappointment (or representation
        ' of the series) - see above for more
        mthAppt.Recurrence = New AppointmentRecurrence()

        ' this will be a monthly recurrence
        mthAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Monthly

        ' the appointment will occur every other month so we specify
        ' a patterninterval of 2
        mthAppt.Recurrence.PatternInterval = 2

        ' to have an appt occur based on a particular pattern (first, second, 
        ' last, etc.) the patterntype must be set to calculated.
        mthAppt.Recurrence.PatternType = RecurrencePatternType.Calculated

        ' then you need to specify the calculatation. in this case, we want 
        ' the last weekday in the month
        mthAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Last
        mthAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays

        ' we could have also specified a particular day
        ' e.g.
        ' appt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday;

        ' set the subject to provide a description of the recurrence info
        ' this will be the subject of all the occurrences until they
        ' are modified to become a variance.
        mthAppt.Subject = "A monthly recurrence that occurs the last weekday of every other month"


        ' For a calculated yearly recurrence, the 
        ' 'PatternOccurrenceOfDayInMonth' is used in conjunction
        ' with the 'PatternDaysOfWeek' and 'PatternMonthOfYear'
        ' to determine when each occurrence will begin.
        '

        ' create a new appointment
        Dim yrAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, String.Empty)
        yrAppt.AllDayEvent = True

        ' create the recurrence object - this appointment
        ' will become the rootappointment (or representation
        ' of the series) - see above for more
        yrAppt.Recurrence = New AppointmentRecurrence()

        ' this is a yearly occurrence
        yrAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly

        ' to have an appt occur based on a particular pattern (first, second, 
        ' last, etc.) the patterntype must be set to calculated.
        yrAppt.Recurrence.PatternType = RecurrencePatternType.Calculated

        ' we are creating an appt for hanksgiving, which 
        ' occurs on the 4th thursday of november so we'll
        ' specify a 'PatternMonthOfYear' of 11 for november
        yrAppt.Recurrence.PatternMonthOfYear = 11

        ' its the fourth thursday so specify fourth...
        yrAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Fourth

        ' and it falls on thursday...
        yrAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Thursday

        ' the description provides a description of the recurrence info
        yrAppt.Subject = "Thanksgiving"
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;

		private void CreateCalculatedMonthlyAndYearlyAppointments()
		{
			// The 'PatternOccurrenceOfDayInMonth' is used by
			// calculated monthly and yearly (see PatternFrequency)
			// recurrences.
			//

			// For a calculated monthly recurrence, the 
			// 'PatternOccurrenceOfDayInMonth' is used in conjuction with 
			// the 'PatternInterval' and 'PatternDaysOfWeek' to 
			// determine which day of the month will be the start 
			// of each occurrence
			//

			// create a new appointment
			DateTime dt = DateTime.Now;
			Appointment mthAppt = this.ultraCalendarInfo1.Appointments.Add(dt, dt.AddHours(3d), string.Empty);

			// create the recurrence object - this appointment
			// will become the rootappointment (or representation
			// of the series) - see above for more
			mthAppt.Recurrence = new AppointmentRecurrence();

			// this will be a monthly recurrence
			mthAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Monthly;

			// the appointment will occur every other month so we specify
			// a patterninterval of 2
			mthAppt.Recurrence.PatternInterval = 2;

			// to have an appt occur based on a particular pattern (first, second, 
			// last, etc.) the patterntype must be set to calculated.
			mthAppt.Recurrence.PatternType = RecurrencePatternType.Calculated;
			
			// then you need to specify the calculatation. in this case, we want 
			// the last weekday in the month
			mthAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Last;
			mthAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays;

			// we could have also specified a particular day
			// e.g.
			// appt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Friday;

			// set the subject to provide a description of the recurrence info
			// this will be the subject of all the occurrences until they
			// are modified to become a variance.
			mthAppt.Subject = "A monthly recurrence that occurs the last weekday of every other month";


			// For a calculated yearly recurrence, the 
			// 'PatternOccurrenceOfDayInMonth' is used in conjunction
			// with the 'PatternDaysOfWeek' and 'PatternMonthOfYear'
			// to determine when each occurrence will begin.
			//

			// create a new appointment
			Appointment yrAppt = this.ultraCalendarInfo1.Appointments.Add(dt, string.Empty);
			yrAppt.AllDayEvent = true;

			// create the recurrence object - this appointment
			// will become the rootappointment (or representation
			// of the series) - see above for more
			yrAppt.Recurrence = new AppointmentRecurrence();

			// this is a yearly occurrence
			yrAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Yearly;

			// to have an appt occur based on a particular pattern (first, second, 
			// last, etc.) the patterntype must be set to calculated.
			yrAppt.Recurrence.PatternType = RecurrencePatternType.Calculated;

			// we are creating an appt for hanksgiving, which 
			// occurs on the 4th thursday of november so we'll
			// specify a 'PatternMonthOfYear' of 11 for november
			yrAppt.Recurrence.PatternMonthOfYear = 11;

			// its the fourth thursday so specify fourth...
			yrAppt.Recurrence.PatternOccurrenceOfDayInMonth = RecurrencePatternOccurrenceOfDayInMonth.Fourth;

			// and it falls on thursday...
			yrAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.Thursday;

			// the description provides a description of the recurrence info
			yrAppt.Subject = "Thanksgiving";
		}
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