Delegating Menu Commands

  • Thread starter Thread starter ian.mcewan
  • Start date Start date
I

ian.mcewan

Hi,

I have three menu user controls (this is for touchscreen
application so they can't be .Net/XP menus).

These menus all represent a common pool of commands, but
for example menu1 has command1, command2, command3,
whereas menu2 has only command2, and so on.

What is the simplest way (preferably without inordinate
redesign and abstraction) to implement ALL the commands
in one class and then hook up the menu user controls to
that class?

Thanks
Ian.
 
Hi Ian

You could use the MenuItem constructor that has the EventHandler delegate
argument. Code from my head, so untested!

HTH

Nigel Armstrong

VB:

Public Class Commands
Public Sub Command1(ByVal sender As Object, ByVal e As EventArgs)

End Sub
'etc

End Class

In the form

Dim c As New Commands
Dim menu1 As New MenuItem("Text", AddressOf c.Command1)
 
Back
Top