|  | 
| Problem adding events with multiple resources | 
| Post Reply   | 
| Author | |
| zeko78   Groupie   Joined: 21 August 2006 Location: Norway Status: Offline Points: 11 |  Post Options  Thanks(0)  Quote  Reply  Topic: Problem adding events with multiple resources Posted: 22 August 2006 at 4:10am | 
| Hi all, I'm new to this control, and I'm trying to understand the MultipleResources stuff. I'm able to set up the calendar with multiple resources (thanks to some posts on the forum), but I'm not able to add events. I'm using C# with the following code:             String strConnectionString = @"Provider=XML;Data Source=c:\CalendarMultipleSchedulesSample.xtp_cal";             CalendarResources resoures = new CalendarResources(); CalendarResource res0 = new CalendarResource(); CalendarResource res1 = new CalendarResource();             res0.SetDataProvider2(strConnectionString, true);             CalendarSchedules schedules = res0.DataProvider.Schedules;             if (schedules.Count < 1) { schedules.AddNewSchedule("John"); schedules.AddNewSchedule("Jane"); res0.DataProvider.Save(); }             schedules[0].Id = 100; res0.Name = schedules[0].Name; res0.ScheduleIDs.Add(schedules[0].Id);             schedules[1].Id = 101; res1.SetDataProvider(res0.DataProvider, false); res1.Name = schedules[1].Name; res1.ScheduleIDs.Add(schedules[1].Id);             resoures.Add(res0); resoures.Add(res1); wndCalendarControl.SetMultipleResources(resoures);             wndCalendarControl.Populate(); wndCalendarControl.RedrawControl();             //Add test event DateTime fromTime = DateTime.Now; DateTime toTime = new DateTime(2006, 8, 22, 11, 11, 11);             CalendarEvent calEvent = res0.DataProvider.CreateEvent(); calEvent.StartTime = fromTime; calEvent.EndTime = toTime; calEvent.Subject = "Hallo"; calEvent.ScheduleID = schedules[0].Id; res0.DataProvider.AddEvent(calEvent); wndCalendarControl.ActiveView.SetSelection(DateTime.Now, toTime, false);             wndCalendarControl.Populate(); wndCalendarControl.RedrawControl(); The code I'm struggeling with is the part after //Add test event The event simply never appears in the calendar... Could someone please point me in the right direction?? Best regards, Gøran | |
|  | |
| sserge   Moderator Group   Joined: 01 December 2004 Status: Offline Points: 1297 |  Post Options  Thanks(0)  Quote  Reply  Posted: 22 August 2006 at 2:38pm | 
| 
   
Hi , 
You forgot to open/create data provider:
 
 -- WBR, Serge | |
|  | |
| zeko78   Groupie   Joined: 21 August 2006 Location: Norway Status: Offline Points: 11 |  Post Options  Thanks(0)  Quote  Reply  Posted: 22 August 2006 at 2:57pm | 
| 
   Doh!  (hand smacking forhead)
 Now it works!! Thank you very much Serge.. Best regards, Gøran | |
|  | |
| 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 |