Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Multiple Resources
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Multiple Resources

 Post Reply Post Reply
Author
Message
Fabian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 22 November 2004
Location: Switzerland
Status: Offline
Points: 336
Post Options Post Options   Thanks (0) Thanks(0)   Quote Fabian Quote  Post ReplyReply Direct Link To This Post Topic: Multiple Resources
    Posted: 30 April 2006 at 11:19am

Hi

I try to incorporate multiple resources in my (working) calendar app.

CalendarControl1.SetDataProvider(...)
CalendarControl1.DataProvider.Open

'----- New code
Set Resources=New CalendarResources
Set Resource=New CalendarResource
Resource.SetDataProvider(CalendarControl1.DataProvider,False )
Set Schedules=Resource.DataProvider.Schedules
Schedules.AddNewSchedule "Test"
Resource.Name="Test"
Resource.ScheduleIDs.Add 1
Resources.Add Resource
Resource.DataProvider.Save
'-----

'Now adding events to CalendarControl1.DataProvider as before.

If we run the app with the new code the resource was shown but the DataProvider is empty and inplace adding an event was no more possible... without the resource addition all work as expected but without resources...

What do I wrong?

Thanks a lot for any help!

Product: Xtreme SuitePro (ActiveX) version 16.2.3

Platform: Windows 7 (32bit)

Language: Visual Basic 6.0 / SP6
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2006 at 6:02am
Hi Fabian,

Firstly please look at corresponding examples in calendar VB sample project:
mnuMultiSchedulesSimple_Click()
mnuMultiSchedulesExtended_Click()
 
1.
instead of
    Resource.ScheduleIDs.Add 1
use:
    Resource.ScheduleIDs.Add Schedules.Item(0).Id
 
2.
instead of
    Schedules.AddNewSchedule "Test"
use:
    If Schedules.Count < 1 Then
        Schedules.AddNewSchedule "Test"
    End If
because XML/file data provider saves/loads schedules when Save/Open methods are called.
 
3.  
Resource.SetDataProvider(CalendarControl1.DataProvider, False)
 
NOTE: if you set False to bCloseDataProviderWhenDestroy - please close (and save if necessary) a DataProvider manually when exit from app/form.
 
4. for events which you add you have to set ScheduleID.

5. Look also at CalendarResource.SetDataProvider2 method.

--
WBR,
Serge
Back to Top
WaaZ View Drop Down
Senior Member
Senior Member


Joined: 31 January 2006
Location: United Kingdom
Status: Offline
Points: 103
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaaZ Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2006 at 7:42am

Hi,

Based on the explanation above, I have implemented the following code:

Quote

CalendarResources Resources = new CalendarResourcesClass();

CalendarResource Resource=new CalendarResourceClass();

Resource.SetDataProvider(CalendarControl.DataProvider,false );

if (CalendarControl.DataProvider.Schedules.Count < 1)

{

CalendarControl.DataProvider.Schedules.AddNewSchedule("Test");

}

Resource.Name="Test";

Resource.ScheduleIDs.Add(CalendarControl.DataProvider.Schedu les[0].Id);

Resources.Add(Resource);

Resource.DataProvider.Save();

and when I create my event after the above has been executed and set the Schedule ID as follows:

Quote

ptrEvent.ScheduleID = CalendarControl.DataProvider.Schedules[0].Id;

I see no difference in the execution. I have done these changes in the sample code given while installing the controls

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 03 May 2006 at 11:07am
Ensure you've called:

CalendarControl.SetMultipleResources(Resources);
CalendarControl.Populate();

 
Compare your code with code in calendar VB sample project:
mnuMultiSchedulesSimple_Click();

--
WBR,
Serge
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.219 seconds.