I'm trying to work out how to use the Implements keyword properly, And I can't Get it to work If i'm using Events.
Say I have a class clsInterface
Code:
Event MyEvent()
Public Property Get MyProperty As Long
End Property
Public Property Let MyProperty (New_MyProperty As Long)
End Property
Public Sub MyMethod()
End Sub
Now I want several Different classes (say cls1,cls2 and cls3) to Implement this interface so I can do something like this
And of coure some other code to make it do something usefulCode:
Dim WithEvents objInstance As clsInterface
Private Sub Form_Load
Select Case Fix(Rnd * 3)
Case 0
Set objInstance = New cls1
Case 1
Set objInstance = New cls2
Case 2
Set objInstance = New cls3
End Select
End Sub
When I try to do this I always get an "Object Or Class does Not Support the set of Events" Error, no matter what events I try to put in cls1, cls2 and cls3.
Can anyone give me an example of a class that Implements clsInterface properly and Supports the Set of Events.
Thanks in Advance.
