Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Recurrence Exceptions (Read 3134 times)
Bud Staniek
Guest


Recurrence Exceptions
Jul 8th, 2006 at 8:21pm
Print Post  
I am extremely impressed with the robustness of the Calendar control but am confused about how recurrence exceptions work. In a previous post, you explained how to delete an occurrence using the MarkException method. But how do you change, for example, the Subject or StartTime for a specific occurrence?

To illustrate I have reproduced the code from your recurrence tutorial below. What code would you add to change the Subject of occurrences 2 and 3 to "Meet Ethel" instead of "Meet George"?


       ' Create the initial appointment
       Dim app As New Appointment
       app.HeaderText = "Meet George"
       app.DescriptionText = "This is a sample appointment"
       app.StartTime = New DateTime(2006, 1, 10, 14, 0, 0)
       app.EndTime = New DateTime(2006, 1, 10, 16, 30, 0)
       Calendar.Schedule.Items.Add(app)

        Create the recurrences
       Dim rec As New Recurrence
       rec.Pattern = RecurrencePattern.Weekly
       rec.DaysOfWeek = DaysOfWeek.Monday Or DaysOfWeek.Wednesday
       rec.Weeks = 2
       rec.StartDate = New DateTime(2006, 1, 10)
       rec.StartHour = 14
       rec.StartMinute = 0
       rec.EndHour = 16
       rec.EndMinute = 30
       rec.RecurrenceEnd = RecurrenceEnd.Never

       app.Recurrence = rec
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Recurrence Exceptions
Reply #1 - Jul 10th, 2006 at 4:43am
Print Post  
Try the following code:

Code
Select All
' Enumerate the occurrences first. Make sure
' the interval is big enough to hold the 2nd and 3rd
' events, which we are interested in
Dim items As ItemCollection = rec.GenerateItems( _
    New DateTime(2006, 1, 1), _
    New DateTime(2006, 2, 1))

' Change the header text of the corresponding items -
' this will automatically mark the items as exceptions
items(1).HeaderText = "Meet Ethel"
items(2).HeaderText = "Meet Ethel" 



Meppy
  
Back to top
 
IP Logged
 
Bud Staniek
Guest


Re: Recurrence Exceptions
Reply #2 - Jul 10th, 2006 at 1:24pm
Print Post  
That makes sense. Much thanks
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint