Print Page | Close Window

Get working: Calendar with customized Datasource

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=20658
Printed Date: 23 April 2024 at 4:01pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Get working: Calendar with customized Datasource
Posted By: el austriaco
Subject: Get working: Calendar with customized Datasource
Date Posted: 02 March 2013 at 3:33am
Hi guys,

I want to use the calendar-control with a customized datasource within Microsoft Access, but despite going through the samples provided (vb, vb.net and access) I couldn''t set it up. I could not find an easy accessible step-by-step guide to what I need. In the following you see how I imagine this to work (from what I have seen in the examples):

In Form_Load the calendar-objects (calender itself and date-picker) are loaded and attached to each other.
Private Sub Form_Load()

      'Load Calendar
      Set m_Calendar = Me.ocxCalendar.Object
      m_Calendar.SetDataProvider "Provider=Custom;"
      m_Calendar.DataProvider.Create

      'Attach Date-Picker to calendar
      Set m_DatePicker = Me.ocxDatePicker.Object
      m_DatePicker.AttachToCalendar m_Calendar

End Sub


As there is no data-source assigned to the calendar I would expect the DoRetrieveDayEvents to be fired by the calendar-object in order to retrieve the events (=Load them to the Events-parameter) for the date-range currently on display. What actually happens is that the event is fired a few thousand times (for each day until year 2020+), seemingly without a reason.  
Private Sub m_Calendar_DoRetrieveDayEvents(ByVal dtDay As Date, ByVal Events As XtremeCalendarControl.CalendarEvents)
   
   m_RdeCounter = m_RdeCounter + 1
   Debug.Print "EVT: m_Calendar_DoRetrieveDayEvents " & dtDay & ", event-occurence " & m_RdeCounter
  
End Sub


What I achieved so far is to load some events to the calendar-control. (But this is not exactly what I want as the user chooses the dates he wants to see within the calendar-controls.)
Private Sub cmdTest_Click()

   Dim c As Calendar 'This is my custom-calendar-object
   Dim i As Calendar_Item
   Dim j As XtremeCalendarControl.CalendarEvent

   'Clear existing events
   m_Calendar.DataProvider.ClearCache

   'Load calendar
   Set c = Cal_Data_Load
  
   'Transfer calendar-items to code-jock-calendar
   For Each i In c.Items
      Set j = m_Calendar.DataProvider.CreateEvent
      Me_Event_HereToJock i, j
      m_Calendar.DataProvider.AddEvent j
   Next

   m_Calendar.DataProvider.Save

   'Redraw contol
   m_Calendar.Populate

End Sub


This actually transfers the properties of 'my' calendar-item to the codejock one. The Id-thing I couldn't figure out either, although I obviously need to re-fetch it when later saving the element in the database.
Private Sub Me_Event_HereToJock(Here As Calendar_Item, ByRef Jock As XtremeCalendarControl.CalendarEvent)

   With Jock
      '.Id = Here.Id
      .StartTime = Here.Date_Start
      .EndTime = Here.Date_End
      .Subject = Here.Text
      .Location = Nz(Here.AdrId, "")
   End With

End Sub


So any chance to get help on this? I would just need a working example for a customized database as described for Ms Access or Vb.net. As I mentioned in the previous post I've already contacted codejock-support without reaction. So I am writing here in order to benefit from public knowledge. Smile

The database containing the above code can be downloaded here:
http://www.zaunsystem.net/cal.zip - http://www.zaunsystem.net/cal.zip

Thanks for any reponse!

Georg



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net