是否可以将事件与VB8中的另一个事件挂钩?
我在C#中有这个代码…
我在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
谢谢!
您只需要在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