Hi all. I'm having troubles trying to understand the GetEvent method. It's suppossed with this method I'm able to get an event from its ID. I'm using MySql database (within a vb6 projet with the classess Codejock provides to help with). Everything works fine except a behavior that I don't understand. I'll briefly explain it (the code at the bottom):
oScheduler = calendar control frmAppointment = event creator/editor frmSelectSeries = edit-delete series or recurrence selector
My point is to get EventID (mysql table EventID field from specific event) from Dataprovider.Event.Id so I can pass it to my own edit event function as a parameter. But "oHitTest.ViewEvent.Id" gets a totally different ID than database does. E.g If database EventID = 3... oHitTest.ViewEvent.Id = -1655 or something else (I assume this unique-number is generated randomly when the events are loaded into the calendar object each time it is created.)
If I use debbuger panel to manually get "oScheduler.Dataprovider.GetEvent(3).Id" then it works fine and it returns "3" as Id.
My question is, Is this working fine? If affirmative, then how can I use the Event.Id property to get the *real* ID (EventID from database) and not that random ID when I doubleclick on an event??
I hope you understand, and thank you in advance.
---------------------------code----------------------------
Private Sub oScheduler_DblClick() Dim oHitTest As CalendarHitTestInfo Set oHitTest = oScheduler.ActiveView.HitTest If oHitTest.ViewEvent Is Nothing Then Call frmAppointment.NewRecord(Me) 'click on blank, create new Record Else If oHitTest.ViewEvent.Event.RecurrenceState <> xtpCalendarRecurrenceNotRecurring Then Call frmSelectSeries.ChooseOccurrence(oHitTest.ViewEvent.Event.Subject, False) Select Case frmSelectSeries.lngResponse Case Is = 0 ' press cancel Case Is = 1 'only this recurrence Call frmAppointment.EditRecord(oHitTest.ViewEvent.Event.ID, Me, 1) Case Is = 2 'edit whole series Call frmAppointment.EditRecord(oHitTest.ViewEvent.Event.ID, Me, 2) End Select Else Call frmAppointment.EditRecord(oHitTest.ViewEvent.Event.ID, Me, 0) End If End If Set oHitTest = Nothing End Sub
|