I'm working on a good sized project and I am having problems raising an event. So I've just created a little test program to work it out. The code seems to work correctly except I never receive the event in my form??
'------------------
' The CLASS
'------------------
Public Event CustomEvent(strText As String)
Public sub RaiseMyEvent(strText As string)
' Raise the event
RaiseEvent CustomEvent(strText)
End Function
'------------------------
' The FORM
'------------------------
Option Explicit
Dim WithEvents MyEvent As clsEvent
Dim objEvent As New clsEvent
Private Sub Form_Load()
Set MyEvent = New clsEvent
End Sub
Private Sub cmdRaise_Click()
' Load Event Requested
objEvent.RaiseMyEvent(Now)
End Sub
Private Sub MyEvent_CustomEvent(strText As String)
lblEventReceived.Caption = "Event Received: " & strText
End Sub
The event is never received in the Form after the Raise button is clicked.?? Any ideas? I'm stumped.
Thanks,
Dave
'------------------
' The CLASS
'------------------
Public Event CustomEvent(strText As String)
Public sub RaiseMyEvent(strText As string)
' Raise the event
RaiseEvent CustomEvent(strText)
End Function
'------------------------
' The FORM
'------------------------
Option Explicit
Dim WithEvents MyEvent As clsEvent
Dim objEvent As New clsEvent
Private Sub Form_Load()
Set MyEvent = New clsEvent
End Sub
Private Sub cmdRaise_Click()
' Load Event Requested
objEvent.RaiseMyEvent(Now)
End Sub
Private Sub MyEvent_CustomEvent(strText As String)
lblEventReceived.Caption = "Event Received: " & strText
End Sub
The event is never received in the Form after the Raise button is clicked.?? Any ideas? I'm stumped.
Thanks,
Dave