Print Page | Close Window

Implementing custom event handlers in .NET

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=4933
Printed Date: 22 November 2024 at 3:29pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Implementing custom event handlers in .NET
Posted By: zotteLORRE
Subject: Implementing custom event handlers in .NET
Date Posted: 31 August 2006 at 5:42am
Hi,


I'm busy evaluating the CalendarPro Active-X in a VB.NET dev enviroment for our company, and have encountered some problems implementing custom event handlers for a MySQL data source.

Implementing doRetrieveDayEvents & doCreateEvent, for example, works fine, but doUpdateEvent doesn't get fired at all.

I've implemented following code directly in the frmMain class:


        Private Sub CalendarControl_doRetrieveDayEvents(ByVal sender As System.Object, ByVal e As AxXtremeCalendarControl._DCalendarControlEvents_DoRetrieveDayEventsEvent) Handles CalendarControl.DoRetrieveDayEvents

            dbController.doQuerySelectEvents(e.dtDay, e.events, CalendarControl.DataProvider, nUserID)

        End Sub

        Private Sub CalendarControl_doCreateEvent(ByVal sender As System.Object, ByVal e As AxXtremeCalendarControl._DCalendarControlEvents_DoCreateEventEvent) Handles CalendarControl.DoCreateEvent

            dbController.doQueryInsertEvent(e.newEventID, e.pEvent, CalendarControl.DataProvider, nUserID, e.bResult)

        End Sub

        Private Sub CalendarControl_doUpdateEvent(ByVal sender As System.Object, ByVal e As AxXtremeCalendarControl._DCalendarControlEvents_DoUpdateEventEvent) Handles CalendarControl.DoUpdateEvent

            MessageBox.Show("test doupdateevent") 'temp
            'dbController.doQueryUpdateEvent(e.pEvent, CalendarControl.DataProvider, nUserID, e.bResult)

        End Sub


Am I wrong putting above code directly in the main form?

Thanks in advance,


Laurent



Replies:
Posted By: sserge
Date Posted: 01 September 2006 at 6:55am
Hi Laurent,

This is strange. I have just tested this -- added 3 empty handlers and all 3 events are coming fine.

DoUpdateEvent comes when you move/resize/edit existing event in the calendar.

My code is like the following:
Private
Sub frmMain1_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase .Load
   CalendarControl.SetDataProvider("Provider=CUSTOM;")
   CalendarControl.DataProvider.Open() ' Ensure that you call Open!
End Sub

Private Sub CalendarControl_DoCreateEvent( ByVal sender As Object ,
   ByVal e As AxXtremeCalendarControl._DCalendarControlEvents_DoCreateEventEvent)
   Handles CalendarControl.DoCreateEvent
End Sub

Private Sub CalendarControl_DoRetrieveDayEvents( ByVal sender As Object ,
   ByVal e As AxXtremeCalendarControl._DCalendarControlEvents_DoRetrieveDayEventsEvent)
   Handles CalendarControl.DoRetrieveDayEvents
End Sub

Private Sub CalendarControl_DoUpdateEvent( ByVal sender As Object ,
   ByVal e As AxXtremeCalendarControl._DCalendarControlEvents_DoUpdateEventEvent)
   Handles CalendarControl.DoUpdateEvent
End Sub

--
WBR,
Serge


Posted By: zotteLORRE
Date Posted: 15 September 2006 at 8:08am
Serge,


Strange indeed, but I guess the problem was somewhere (?) in my code.

After lots of debugging, I decided to start from scratch and use the VB6 sample as an example (and read the documentation...).

A little bit embarassing, since I didn't manage to find the bug...

Anyway, everything works fine now!

Thanks for your time,


Laurent



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