VB.NET Add handler without event handler?

268 Views Asked by At

Is there a way for me to just specify an event handler without creating a new sub?

For example... Normally I would do something like the following:

AddHandler btn.click, EventHandler OpenDirectory

Private Sub OpenDirectory
     Process.Start("SomeDir")
End Sub

As you can see, the sub is just a one line of code. So, can I simplify it down and do something like the following:

AddHandler btn.click, Process.Start("SomeDir")

I know the above doesn't work, but I'm hoping I'm being clear in what I want to do with the example.

0

There are 0 best solutions below