M
Michael Maes
Hello,
I wan't to address ComponentTray Objects such as Timers, NotifyIcons, ContextMenus, ..., in short: objects that don't belong to the Forms' ControlCollection.
The trick is I want to do this not knowing (in design-time) whether they will exist on "a" form, even worse, not knowing their name at all (but knowing their class).
Let's say, as example, that I have an MDI-Application and that all forms are inherited from "a" BaseForm (which in turn inherits from System.Windows.Forms.Form) which has extended methods, events & properties.
One of the things the BaseForm does is (eg) adding a MenuItem to a ContextMenu. Now the BaseForm doesn't 'know' if there will be a ContextMenu, nor what it's name will be.
With "normal" controls I just perform a recursive scan through the Forms' ControlCollection (upon instantiation) and I put the controls in a HashTable.
With ComponentTray Objects, this trick won't work because they do not belong to the Forms' ControlCollection.
I guess that this "smells like" Reflection, but I haven't had the time to get into that (yet).
Any suggestion would be highly appreciated,
I work with vb.NET (but cs.NET I equally welcome)
Michael
PS: I'll be out of office till saturday, so I won't be able to react before sunday.
TIA
I wan't to address ComponentTray Objects such as Timers, NotifyIcons, ContextMenus, ..., in short: objects that don't belong to the Forms' ControlCollection.
The trick is I want to do this not knowing (in design-time) whether they will exist on "a" form, even worse, not knowing their name at all (but knowing their class).
Let's say, as example, that I have an MDI-Application and that all forms are inherited from "a" BaseForm (which in turn inherits from System.Windows.Forms.Form) which has extended methods, events & properties.
One of the things the BaseForm does is (eg) adding a MenuItem to a ContextMenu. Now the BaseForm doesn't 'know' if there will be a ContextMenu, nor what it's name will be.
With "normal" controls I just perform a recursive scan through the Forms' ControlCollection (upon instantiation) and I put the controls in a HashTable.
With ComponentTray Objects, this trick won't work because they do not belong to the Forms' ControlCollection.
I guess that this "smells like" Reflection, but I haven't had the time to get into that (yet).
Any suggestion would be highly appreciated,
I work with vb.NET (but cs.NET I equally welcome)
Michael
PS: I'll be out of office till saturday, so I won't be able to react before sunday.
TIA