|  | 
| Load multiple resources and events | 
| Post Reply   | 
| Author | |
| Rod001   Newbie   Joined: 29 September 2006 Location: United States Status: Offline Points: 25 |  Post Options  Thanks(0)  Quote  Reply  Topic: Load multiple resources and events Posted: 29 September 2006 at 11:56am | 
| 
   Hi,
 I'm new to this control, and I'm trying to test and understand the MultipleResources and date events. I'm able to set up the calendar with multiple resources but not able to add any date events. Private Sub Form_Load() Init BuildResourceItems "john,tim,rod,bill,nancy"   End Sub Public Sub BuildResourceItems(sNames As String) Dim arResources As New CalendarResources Dim pRes0 As New CalendarResource Dim pRes1 As New CalendarResource Dim NewEvent As CalendarEvent Dim pSchedules As CalendarSchedules Dim strConnectionString As String Dim sArray() As String Dim ldx As Integer strConnectionString = "Provider=Custom;Data Source=" pRes0.SetDataProvider2 strConnectionString, True If pRes0.DataProvider Is Nothing Then Debug.Assert False Exit Sub End If If Not pRes0.DataProvider.Open Then If Not pRes0.DataProvider.Create Then Debug.Assert False Exit Sub End If End If  '// ** schedules Set pSchedules = pRes0.DataProvider.Schedules sArray = Split(sNames, ",") For ldx = 0 To UBound(sArray) pSchedules.AddNewSchedule sArray(ldx) Next pRes0.DataProvider.Save pRes1.SetDataProvider pRes0.DataProvider, False pRes0.Name = pSchedules.Item(0).Name pRes0.ScheduleIDs.Add pSchedules.Item(0).Id sArray = Split(sNames, ",") For ldx = 0 To UBound(sArray) Set pRes1 = New CalendarResource     pRes1.Name = sArray(ldx) pRes1.ScheduleIDs.Add ldx arResources.Add pRes1 Next CalendarControl1.SetMultipleResources arResources    Set NewEvent = CalendarControl1.DataProvider.CreateEvent ' error problem occurs here NewEvent.StartTime = Now NewEvent.EndTime = Now NewEvent.Subject = "Product Meeting" NewEvent.ScheduleID = 1 CalendarControl1.DataProvider.AddEvent NewEvent  CalendarControl1.Populate End Sub Thank you, Rod001 | |
|  | |
| sserge   Moderator Group   Joined: 01 December 2004 Status: Offline Points: 1297 |  Post Options  Thanks(0)  Quote  Reply  Posted: 03 October 2006 at 10:44am | 
| 
   Hi, You just mixed up some things a little, and as result - no data provider is attached to Calendar at all. I mean that you create data provider in pRes0 but skip a step of adding pRes0 to an array. Also you have to set data provider to each resource. 
 -- WBR, Serge | |
|  | |
| Rod001   Newbie   Joined: 29 September 2006 Location: United States Status: Offline Points: 25 |  Post Options  Thanks(0)  Quote  Reply  Posted: 03 October 2006 at 2:46pm | 
| Serge, The changes work great! I am trying to develop a proof of concept for our management team and would appreciate any and all help. After updating the code with the changes I can't seem to make the events for adding dates to show up in the calendar. Thank you, Rod001  | |
|  | |
| Rod001   Newbie   Joined: 29 September 2006 Location: United States Status: Offline Points: 25 |  Post Options  Thanks(0)  Quote  Reply  Posted: 05 October 2006 at 3:01pm | 
| Sorry for the previous question, everything did work. Things works a lot better when you (me) cuts and paste all the code. Thanks again, Rod001 | |
|  | |
| 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 |