访问 vb.net 中声明的事件时遇到问题。
请仔细阅读下面的示例。(我已经修改了以下内容以使其不稳定,因为它是自定义控件开发之一的一部分)
Public Class Main
Inherits ComboBox
'Event handler for when an item check state changes.
Public Event ItemCheck As ItemCheckEventHandler
Private parentMainClass As Main
Private cclb As controlClass
Public Sub New(parentclass As Main)
Me.parentMainClass = parentclass
'Add a handler to notify our parent of ItemCheck events.
AddHandler Me.cclb.ItemCheck, New System.Windows.Forms.ItemCheckEventHandler(AddressOf Me.cclb_ItemCheck)
End Sub
Private Sub cclb_ItemCheck(sender As Object, e As ItemCheckEventArgs)
'If ccbParent.ItemCheck IsNot Nothing Then
RaiseEvent parentMainClass.ItemCheck(sender,e)
'End If
End Sub
Public Class controlClass
Inherits CheckedListBox
End Class
End Class
问题:RaiseEvent parentMainClass.ItemCheck(sender,e)
此语句显示 - ItemCheck 事件不存在,即使它存在。
请指导。
谢谢你