Version

RangeLimit Property

Gets/sets the limiting factor of the recurrence, i.e., whether it never ends, ends after a certain number of occurrences, or ends on or before a certain date.
Syntax
'Declaration
 
Public Property RangeLimit As RecurrenceRangeLimit
public RecurrenceRangeLimit RangeLimit {get; set;}
Example
The following example demonstrates how to use the 'RangeLimit' property to limit the number of occurrences for a recurring appointment.

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

    Private Sub CreateLimitedRecurrences()
        ' The 'RangeLimit' is used to indicate what will
        ' determine when the last occurrence will occur.
        ' By default, this is set to NoLimit and is only
        ' limited by the MaxDate of the containing
        ' calendarinfo. When set to 'LimitByNumberOfOccurrences',
        ' the recurrence will be limited by the 
        ' 'RangeMaxOccurrences' value. When set to
        ' 
        '

        ' The following recurrence is not limited
        ' other then by the max date of the associated
        ' calendar info.
        '
        Dim dt As DateTime = DateTime.Now
        Dim dailyAppt 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) - it's 'IsRecurringAppointmentRoot'
        ' will return true and it will not displayed in 
        ' the associated controls. instead, instances or 
        ' occurrences of the recurrence will appear in the
        ' the controls associated with the calendar info.
        dailyAppt.Recurrence = New AppointmentRecurrence()

        ' This will be a daily recurrence that will occur
        ' each weekday
        dailyAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily

        ' In this case, we use the 'PatternDaysOfWeek' to
        ' indicate that the daily occurrences should fall
        ' on every weekday (each day but saturday and sunday).
        dailyAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays

        dailyAppt.Recurrence.RangeLimit = RecurrenceRangeLimit.NoLimit

        ' assign a subject [not required]
        dailyAppt.Subject = "A daily activity that occurs every weekday with no limits"


        ' Another appointment with the same information
        ' that will end after 10 occurrences...
        '
        Dim dailyAppt2 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
        dailyAppt2.Recurrence = New AppointmentRecurrence()

        ' This will be a daily recurrence that will occur
        ' each weekday
        dailyAppt2.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily

        ' In this case, we use the 'PatternDaysOfWeek' to
        ' indicate that the daily occurrences should fall
        ' on every weekday (each day but saturday and sunday).
        dailyAppt2.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays

        ' the RangeLimit here is used to indicate
        ' that it has a limited # of occurances but
        ' is not limited by date (other then the maxdate
        ' of the calendarinfo)
        dailyAppt2.Recurrence.RangeLimit = RecurrenceRangeLimit.LimitByNumberOfOccurrences

        ' the 'RangeMaxOccurrences' is used to indicate
        ' the limiting number of occurrences.
        dailyAppt2.Recurrence.RangeMaxOccurrences = 10

        ' assign a subject [not required]
        dailyAppt2.Subject = "A daily activity that occurs every weekday for 10 occurrences"



        ' Another appointment with the same information
        ' that will end in 30 days
        '

        Dim dailyAppt3 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
        dailyAppt3.Recurrence = New AppointmentRecurrence()

        ' This will be a daily recurrence that will occur
        ' each weekday
        dailyAppt3.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily

        ' In this case, we use the 'PatternDaysOfWeek' to
        ' indicate that the daily occurrences should fall
        ' on every weekday (each day but saturday and sunday).
        dailyAppt3.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays

        ' the RangeLimit here is used to indicate
        ' that no occurrences will occur after
        ' the specified end date
        dailyAppt3.Recurrence.RangeLimit = RecurrenceRangeLimit.LimitByDate

        ' the 'RangeEndDate' is used to indicate
        ' the last possible date for an occurrence
        dailyAppt3.Recurrence.RangeEndDate = dt.AddDays(30D)

        ' assign a subject [not required]
        dailyAppt3.Subject = "A daily activity that occurs every weekday for the next 30 days"

    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;

		private void CreateLimitedRecurrences()
		{
			// The 'RangeLimit' is used to indicate what will
			// determine when the last occurrence will occur.
			// By default, this is set to NoLimit and is only
			// limited by the MaxDate of the containing
			// calendarinfo. When set to 'LimitByNumberOfOccurrences',
			// the recurrence will be limited by the 
			// 'RangeMaxOccurrences' value. When set to
			// 
			//

			// The following recurrence is not limited
			// other then by the max date of the associated
			// calendar info.
			//
			#region NoLimit

			DateTime dt = DateTime.Now;
			Appointment dailyAppt = 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) - it's 'IsRecurringAppointmentRoot'
			// will return true and it will not displayed in 
			// the associated controls. instead, instances or 
			// occurrences of the recurrence will appear in the
			// the controls associated with the calendar info.
			dailyAppt.Recurrence = new AppointmentRecurrence();

			// This will be a daily recurrence that will occur
			// each weekday
			dailyAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily;

			// In this case, we use the 'PatternDaysOfWeek' to
			// indicate that the daily occurrences should fall
			// on every weekday (each day but saturday and sunday).
			dailyAppt.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays;

			dailyAppt.Recurrence.RangeLimit = RecurrenceRangeLimit.NoLimit;

			// assign a subject [not required]
			dailyAppt.Subject = "A daily activity that occurs every weekday with no limits";

			#endregion //NoLimit


			// Another appointment with the same information
			// that will end after 10 occurrences...
			//
			#region LimitByNumberOfOccurrences

			Appointment dailyAppt2 = 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
			dailyAppt2.Recurrence = new AppointmentRecurrence();

			// This will be a daily recurrence that will occur
			// each weekday
			dailyAppt2.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily;

			// In this case, we use the 'PatternDaysOfWeek' to
			// indicate that the daily occurrences should fall
			// on every weekday (each day but saturday and sunday).
			dailyAppt2.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays;

			// the RangeLimit here is used to indicate
			// that it has a limited # of occurances but
			// is not limited by date (other then the maxdate
			// of the calendarinfo)
			dailyAppt2.Recurrence.RangeLimit = RecurrenceRangeLimit.LimitByNumberOfOccurrences;

			// the 'RangeMaxOccurrences' is used to indicate
			// the limiting number of occurrences.
			dailyAppt2.Recurrence.RangeMaxOccurrences = 10;

			// assign a subject [not required]
			dailyAppt2.Subject = "A daily activity that occurs every weekday for 10 occurrences";

			#endregion //LimitByNumberOfOccurrences


			// Another appointment with the same information
			// that will end in 30 days
			//
			#region LimitByNumberOfOccurrences

			Appointment dailyAppt3 = 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
			dailyAppt3.Recurrence = new AppointmentRecurrence();

			// This will be a daily recurrence that will occur
			// each weekday
			dailyAppt3.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily;

			// In this case, we use the 'PatternDaysOfWeek' to
			// indicate that the daily occurrences should fall
			// on every weekday (each day but saturday and sunday).
			dailyAppt3.Recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.AllWeekdays;

			// the RangeLimit here is used to indicate
			// that no occurrences will occur after
			// the specified end date
			dailyAppt3.Recurrence.RangeLimit = RecurrenceRangeLimit.LimitByDate;

			// the 'RangeEndDate' is used to indicate
			// the last possible date for an occurrence
			dailyAppt3.Recurrence.RangeEndDate = dt.AddDays(30d);

			// assign a subject [not required]
			dailyAppt3.Subject = "A daily activity that occurs every weekday for the next 30 days";

			#endregion //LimitByNumberOfOccurrences
		}
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