menuitem name

E

Edwin Bach

how can you get the name of a menuitem programatically and return is as a
string, for example if
Friend WithEvents mnuExit As System.Windows.Forms.MenuItem

is defined how can you go get the mnuExit

TIA

Ed
 
A

Armin Zingler

Edwin Bach said:
how can you get the name of a menuitem programatically and return is
as a string, for example if
Friend WithEvents mnuExit As System.Windows.Forms.MenuItem

is defined how can you go get the mnuExit

Why do you need it? I ask because variables names are out of interest at run
time. You can identify the menu item by the reference. Or, you can add menu
items to a Hashtable and use an expressive name as the key.
 
E

Edwin Bach

using a database to drive authorizations for users. want to use the name of
the menu item to look up then enable/disable or visible/not visible
 
H

Herfried K. Wagner [MVP]

* "Edwin Bach said:
using a database to drive authorizations for users. want to use the name of
the menu item to look up then enable/disable or visible/not visible

As Armin mentioned, you can do this by storing (name, reference) pairs
in a 'Hashtable'.
 

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