我做测试的代码,为什么不能触发事件。我设断点一切都正常就是到了AddHandler aa.test, AddressOf Me.T这里时就没反应了,函数T死活没反应谁帮我看一下啊。
=====================以下是主窗体代码
Private Sub T(ByVal strs As String)
MessageBox.Show(strs)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim aa As New Class1("111")
AddHandler aa.test, AddressOf Me.T
End Sub
=====================以下是类代码。==注:我是单写了一个类文件。
Public Class Class1
Dim name As String
Public Event test(byval strs as String)
Public Sub New(ByVal str As String)
name = str
st()
End Sub
Sub st()
'MessageBox.Show("aaa")
RaiseEvent test("1111")
End Sub
End Class