Yes. You can use AddHandler
to assign a method to handle the MenuItem.Action
event for any menuitem you have a reference to.
Handler methods MUST conform to the same method signature (same number, type, and order of parameters and the same return type, if any) of the event they are handling. In addition to whatever parameters a particular event defines, all handler methods will receive a reference to the object it's assigned to, passed as the first parameter, followed by whatever other parameters are defined.
To handle the MenuItem.Action Event, a method similar to this one is needed:
Function MyMenuHandler(Sender As MenuItem) As Boolean
MsgBox("You clicked it!")
Any time you create a new MenuItem that needs to be handled by this method, you would use AddHandler to assign the method to the event:
More about AddHandler and events
Dim mnu As New MenuItem("Foo")
AddHandler mnu.Action, AddressOf MyWindow.FooHandler