|
-
Aug 20th, 2002, 01:48 PM
#1
Thread Starter
New Member
Finding the name of a menu item
Does anyone know how to find the NAME of an individual menu item if it is part of an ArrayList or Collection? My security method for forms in VB6 has always been to add controls to a collection when loading the form, then do a For..Each loop on the collection, checking to see if the control's name is in the user's list of permitted controls. The list of permitted controls is derived from the list of database roles that the user belongs to, either directly or indirectly. If it is not in the list, I make the control invisible.
This is a problem in .NET, because the MenuItem object doesn't have a Name property, nor does a ToolBarButton. I tried the ToString method, but the name isn't contained there either. I could possibly use the Text property, but this isn't guaranteed to be unique among all of the menu items on a form, and it can contain spaces, but database roles cannot.
It seems like I will have to set up a class that contains the control and has a Name property that I can refer to. I can do this, but it seems like I am missing something simple.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|