Converting text to menu item?

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
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.
 
* "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.
 
Back
Top