我有通过代码(动态)生成的按钮。我必须将一个事件(相同的)与他们联系起来。我用AddHandler button.click, AddressOf mysub
.
问题是 mysub 得到一个字符串 ( mysub(string
)),但 AddressOf 不接受例程内的参数。我怎样才能做到这一点?也使用 AddressOf 的替代方法。
Public Class Form1
...
Private Sub mysub(ByVal sender As Object, ByVal e As System.EventArgs, ByVal str As String)
...
...
End Sub
...
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
...
While something
...
Dim btn As New Button
...
AddHandler btn.click, AddressOf mysub 'here the issue
End While
...
End Sub
End Class