|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Delegating Menu CommandsHi,
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) Show quoteHide quote "ian.mce***@atonement.net" wrote: > 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. >
Other interesting topics
DataBinding, grr
Is C# is having a seperate class library? Add result using EnumWindow/GetWindowText ListBox problem Calculations with DateTime fields using DataColumn.Expression stri I need to run a vb.net or aspx.net file every 10 seconds. Threads with Windows. How to get a file's date/time correctly? Tabbing to next field after Return key Making part of a string BOLD |
|||||||||||||||||||||||