Delegating Menu Commands

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.
 
G

Guest

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top