Converting text to menu item?

N

news.microsoft.com

I am trying to write a menu handler to enable/disable menu selections
based on user permissions. I did this in VB6 - no problem - but since
I have now lost the name of the menu, I'm trying to come up with an
alternate way to do this.

In my database, I have an array declared as string type that holds a
list of menu names (mnuFile, for example) that I pull back. I need to
take the mnuFile text string from the array and convert it to type
menuitem, but when I try and do a ctype, I get the error "Value of
type 'string' cannot be converted to 'system.windows.forms.menuitem".

How do I do this? Is my original type declaration wrong? Should it
be object? TIA.

W.
 
H

Herfried K. Wagner [MVP]

* "news.microsoft.com said:
I am trying to write a menu handler to enable/disable menu selections
based on user permissions. I did this in VB6 - no problem - but since
I have now lost the name of the menu, I'm trying to come up with an
alternate way to do this.

In my database, I have an array declared as string type that holds a
list of menu names (mnuFile, for example) that I pull back. I need to
take the mnuFile text string from the array and convert it to type
menuitem, but when I try and do a ctype, I get the error "Value of
type 'string' cannot be converted to 'system.windows.forms.menuitem".

How do I do this? Is my original type declaration wrong? Should it
be object? TIA.

You can't. All you can do is adding (Name, 'MenuItem') pairs to a
'Hashtable' and look up references to menu items by name.
 

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