Reputation: 560
Is it possible to hook up an event to another event in VB8? I have this code in C#...
public event ShowAboutDialog = delegate {};
private void hookupEvents() {
myButton.Click += ShowAboutDialog;
}
And am trying to convert it into VB8, but can't get it to work..
Public Event ShowAboutDialog As EventHandler
Private Sub HookupEvents()
AddHandler AboutMenuItem.Click, AddressOf ShowAboutDialog
End Sub
Thanks!
Upvotes: 6
Views: 3884
Reputation: 4673
You just need to pass the name of the event handler routine after 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
Upvotes: 5