Context Menus

J

JezB

Given a reference to a Form object, I want to do some processing on each of
the ContextMenus used in that form. How can I do this easily ?

The only way I can think of is to parse the entire Controls collection and
evaluate each one to determine if it has a ContextMenu attached, and then to
keep a hashtable of each one processed to ensure I dont process the same one
more than once (if a context menu is used by several controls).

There must be an easier way surely !
 
E

Ed Kaim [MSFT]

Unless you can track each context menu as it's created and add it to a
master hastable, I can't think of a better way. It sounds like you're
looking to make a generic method that takes a Form object for the
processing. If there was a method that returns an array of all context menus
on a form (or something like that) it would be ideal, but I don't think
there's anything like that.
 

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