Managing Menus
-
I have a VB 6 app where we control which menu items to enable based on security policies assigned to users. To automate the code we stored the menu control names in a table and then assigned these to various security groups. When a user logged on we read in the list of menus. We than looped through all the controls on the form and looked for controls with ames that match our list and eabled/dissabled appropiately. in Dot net for some reason Microsoft have hidden the "name" propert for menuitem & panelbutton controls. this means that I CANNOT just loop through a collection and check their names. I have tried using the REFELCTION code but still cannot see the names of these controls. Does nayone know of a way to either get these controls names or doing what i did so easilly in VB6. Please DO NOT tell me to hard code the checking in the form. This would mean that every time I adda new menu item I am going to have to add code in the form to enable/dissable it. Rembeber I might end up having over a hundred forms.! Thanks in Advance Del
-
I have a VB 6 app where we control which menu items to enable based on security policies assigned to users. To automate the code we stored the menu control names in a table and then assigned these to various security groups. When a user logged on we read in the list of menus. We than looped through all the controls on the form and looked for controls with ames that match our list and eabled/dissabled appropiately. in Dot net for some reason Microsoft have hidden the "name" propert for menuitem & panelbutton controls. this means that I CANNOT just loop through a collection and check their names. I have tried using the REFELCTION code but still cannot see the names of these controls. Does nayone know of a way to either get these controls names or doing what i did so easilly in VB6. Please DO NOT tell me to hard code the checking in the form. This would mean that every time I adda new menu item I am going to have to add code in the form to enable/dissable it. Rembeber I might end up having over a hundred forms.! Thanks in Advance Del
I had a similar problem with the MenuItem control, and I got around it by assigning string information to the Tag property. When looping through a collection of controls, I checked the type to see if it was a MenuItem, and if it was, I compared against the Tag instead of the Name like I was using for the rest of the controls. This still means you'd need to add the Tag info to all those forms, but your application code would still just be in the one place. To not know is bad. To not wish to know is worse.