I need to extract the name of a menuitem at runtime using reflection, but it does not have a name property or any custom property which seems appropriate!
The situation is: I set up the security for the controls on the form dynamically from a db in the backend using the names of the controls on the form. Works well for everything, except the menu's, as these are not in the controls collection. When a menuitem recieves the "Click" event, I can identify the menuItem by using the event parameter Sender. A MenuItem does not have a Name property however, so I'm back to square one! I tried to extract the name of the local variable that defines the instance (private withevents mymenu as ....), but am struggling to get this. Can anyone help me to extract anything unique per menu item (which is human readable as well) or maybe help me cycle through the local variables on the form (to compare it to the Sender object in the click event) Thanks JC Oberholzer You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.