Hi Nicholas,
What I am trying to do is to duplicate menu items in my application.
If you take a look at MS Outlook (2003 version for instance) you may create
a new message, contact, task ... from the "File..New" menu but you can also
do it by clicking in the toolbar on the "New" button which gives the exact
same list of choices.
That is exactly what I want in my own project : if I edit/add a menu item in
the "File..New" window menu I wouls like it to be repercuted to the "New"
button.
Actually I managed to dynamically duplicates the menu items, by browsing the
menu items collection, but I cannot find how to make the dynamic menu items
behave like the original ones.
I hope this is clear ....
Thank anyway for your information which seems to mean that there is no
straight way I couldn't find.
Lilian
"Nicholas Paldino [.NET/C# MVP]" wrote:
Lilian,
The EventInfo class will show you the events on a type, but it won't
help you get at the delegates. What you really want is to find the
FieldInfo instance which corresponds to the field that is the backing store
for the event.
Unfortunately, there is no concrete link between an event and that
field. You would have to develop a heuristic to figure out what the
association is.
Because of this, I would ask what exactly you are trying to do this for.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Lilian" <Li****@discussions.microsoft.comwrote in message
news:57**********************************@microsof t.com...
Hi,
In a Windows Form I created a set of ToolStripMenuItems.
I am looking for a method to list, for a specific ToolStripMenuItem, the
Click EventHandlers (if any) so as to add them to another control.
I found System.Reflection.EventInfo class which seems to achieve this kind
of enumeration but I did not found how to make it work.
PS : I'm using VS2K5 and FW 2.0.
Thank you in advance