How to Modify m_pRPattern.RemoveAllExceptions |
Post Reply |
Author | |
dangier
Groupie Joined: 10 January 2007 Status: Offline Points: 13 |
Post Options
Thanks(0)
Posted: 10 January 2007 at 6:08pm |
I'm using the VB6 ActiveX Xtreme Calendar Control. The current code behind the btnOK button of frmEditRecurrence is: Private Sub btnOK_Click()
UpdatePatternFromControls
If m_pRPattern.Exceptions.Count > 0 Then Dim nRes nRes = MsgBox("This series will be updated. Is this OK?", vbOKCancel) If nRes = vbCancel Then Exit Sub End If m_pRPattern.RemoveAllExceptions End If m_pMasterEvent.UpdateRecurrence m_pRPattern ''=====================================================
Unload Me I want to modify the frmEditRecurrence form so that if a user wants to edit a series, only the recurrence events from the current calendar date forward are changed (not any historical recurrences for that event).
I know this is not an Outlook behavior, but it's a very critical one for the project I'm working on.
Any idea how I could modify the btnOK code to store the old recurrence series and create a new recurrence series?
Your guidance is sincerely appreciated.
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Hi,
The solution would be similar to what I've described for you in IssueTrack could weeks earlier: 1. An easy solution. To store previous recurrence events you have to divide existing series to 2 parts: a) Old recurrence series - finished at a current date; b) New recurrence series - started at current date. So far there will be 2 operations: a) modify the end date for existing MasterEvent->RecurrencePattern without calling RemoveAllExceptions; b) create a copy of changed series (with Recurrence) starting from the current date; 2. Yet another solution. Use an existing master event. a. Get collection of all backward (historical) recurrence events (exception or occurrences). b. Modify master event using new properties. (Commit it to data provider) c. Get collection of all backward (historical) recurrence events for new series. d. for each event from collection "c" add event from collection "a" as an exception. if "c" has more events than "a" rest events from "c" add as deleted exceptions. if "a" has more events than "c" rest events from "a" add as exceptions which are not related to any occurrence. (Commit it to data provider) You see that the second way is complex. And if your 'historical' events collection will grows up to 100-200... events for each master event this may slow down performance. I recommend you way 1, it is easier. But if you need to have only one master event for each series - use way 2. -- WBR, Serge |
|
dangier
Groupie Joined: 10 January 2007 Status: Offline Points: 13 |
Post Options
Thanks(0)
|
Hi Serge, Thank you for your response. I apologize for the redundancy. I missed your earlier message due to hosting email issues.Your reply is greatly appreciated!
|
|
dangier
Groupie Joined: 10 January 2007 Status: Offline Points: 13 |
Post Options
Thanks(0)
|
As you can probably guess, I'm fairly new to VB6, but working my way through it. I'm using your first solution and successfully modified the begin and end dates for an existing MasterEvent -> RecurrencePattern.
I've been struggling with creating a copy of the changed series. Would you please give me a sample of code to get me started in the right direction? Do I use the CalendarControl.DataProvider.CreateEvent method? The more I work through this Xtreme Calendar Control, the more impressed I am it. Thank you for all your help! |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Please look at our VB Sample, frmMain, Form_Load
There are 2 samples how to create a recurrence 1. A simple one after line If bAddRecurrenceEvent Then 2. An extended one is commented, after line ' extended recurrence example: Uncomment it and play :) These 2 peces of code are designed to help understand recurrence ideas. 3. And after that you can take a look at forms which edit events and recurrence for more details. -- WBR, Serge |
|
dangier
Groupie Joined: 10 January 2007 Status: Offline Points: 13 |
Post Options
Thanks(0)
|
Thank you, Serge. I've been looking at forms that edit events and recurrence for bits of code. And your direction helps.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |