是否可以将事件与VB8中的另一个事件挂钩? 我在C#中有这段代码......
public event ShowAboutDialog = delegate {};
private void hookupEvents() {
myButton.Click += ShowAboutDialog;
}
我正在尝试将其转换为VB8,但无法让它工作..
Public Event ShowAboutDialog As EventHandler
Private Sub HookupEvents()
AddHandler AboutMenuItem.Click, AddressOf ShowAboutDialog
End Sub
谢谢!
答案 0 :(得分:4)
您只需要在 AddressOf
之后传递事件处理程序例程的名称Private Sub HookupEvents()
AddHandler AboutMenuItem.Click, AddressOf ShowAboutDialog
End Sub
Public Sub ShowAboutDialog(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub