[英]Implementing interface's event in VBA
I have an interface IView: 我有一个接口IView:
Option Explicit
Public Event OnClientSelected()
Public Property Get ClientNames() As Variant
End Property
(...)
But I am not able to implement the event in my user form. 但是我无法以我的用户形式实施该事件。 Properties and subs are allowed to implement, but event not.
允许实现属性和子对象,但不允许事件。
Is it possible to make interface implementation with events? 是否可以通过事件实现接口?
Did you use withevents? 您使用withevents吗?
I've done the following, added a test
function to your class 我已完成以下操作,并向您的班级添加了
test
功能
Private WithEvents iface As clsIface
Private Sub UserForm_Initialize()
Set iface = New clsIface
End Sub
Private Sub iface_OnClientSelected()
' Event subscription
End Sub
Private Sub UserForm_Click()
iface.test
End Sub
Function added to class 添加到类的功能
Public Function test()
RaiseEvent OnClientSelected
End Function
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.