Hi,
I, ve got a Business layer component which implements an interface from a interface component.
Now I would also like to add withevents, but I don't know where to place the definition of the event or if this is at all possible (couldn't find it in the MSDN).
If I put the definition in the interfaceclass and try to raise the event in the businessclass this doesn't work, because the businessclass doesn't know the event. If I put the definition in both classes, I get an error on my 'Set' statement and it says "Object or class does not support the set of events".
I'm out of options here...
Here 's an example of what I'm trying to do:
If anybody can make sense out of the above and help me, I'm a glad person.
Jordi Reineman
I, ve got a Business layer component which implements an interface from a interface component.
Now I would also like to add withevents, but I don't know where to place the definition of the event or if this is at all possible (couldn't find it in the MSDN).
If I put the definition in the interfaceclass and try to raise the event in the businessclass this doesn't work, because the businessclass doesn't know the event. If I put the definition in both classes, I get an error on my 'Set' statement and it says "Object or class does not support the set of events".
I'm out of options here...
Here 's an example of what I'm trying to do:
Code:
'Project: Blayer
'Class: BLClass
'Code:
Option Explicit
Public Event SaySomething(ByVal What As String)
Implements Iface.IClass
Private Function IClass_RaiseSomeEvent(ByVal Message As String) As Boolean
RaiseEvent SaySomething(Message)
End Function
'Project: Iface
'Class: IClass
'Class: Dummy (empty)
'Code IClass:
Option Explicit
Public Event SaySomething(ByVal What As String)
Public Function RaiseSomeEvent(ByVal Message As String) As Boolean
End Function
'Project: Normal exe with a cmd button and a textbox
'Code:
Option Explicit
Private WithEvents m_oBL As Iface.IClass
Private Sub Command1_Click()
Set m_oBL = New BLayer.BLClass
Call m_oBL.RaiseSomeEvent(Text1.Text)
Set m_oBL = Nothing
End Sub
Private Sub m_oBL_SaySomething(ByVal What As String)
MsgBox What
End Sub
If anybody can make sense out of the above and help me, I'm a glad person.
Jordi Reineman