473,396 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Converting text to menu item?

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.
Nov 20 '05 #1
1 1064
* "news.microsoft.com" <no*****@nothanks.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Keith MacDonald | last post by:
Hello, Is there a portable (at least for VC.Net and g++) method to convert text between wchar_t and char, using the standard library? I may have missed something obvious, but the section on...
1
by: Sketcher | last post by:
Hi all, I have a basic menu (compatible with IE and N6), the code of which is shown below. Is there any way that I can tidy this up - perhaps define the criteria once only for the entire menu....
8
by: Mikey | last post by:
I have an XML document as follows: <Menu> <Group> <Item Text="About Us" AccessRoles="All"> <Group> <Item Text="Option 1" AccessRoles="All" /> <Item Text="Option 2" AccessRoles="All" /> <Item...
3
by: Henry | last post by:
I am trying to convert code that worked in a Visual Studio 2003 project to code that will work in a Vsual Studio 2005 project and need help. The following is the VS2003 code: private void...
5
by: k.vanderstarren | last post by:
Hi All, I'm trying to convert some ASP.NET code that I found at http://weblogs.asp.net/dannychen/archive/2005/12/02/432190.aspx from VB to C#. I've managed to convert the portion that is in...
12
by: tim | last post by:
I am using foldoutmenu 3 and am having problems with viewing my menus in firefox. On my sub3 menus i have more than one line of text in some places. firefox does not recognise that there is more...
25
by: Blasting Cap | last post by:
I keep getting errors that pop up when I am trying to convert an application from dotnet framework 1.1 to framework 2.0. The old project was saved in sourcesafe from Visual Studio 2003, and I have...
2
by: eBob.com | last post by:
I've been working on an app which has an array of RichTextBoxes. And I have a context menu for the RTBs. The context menu has two levels; the first level has two items, "Load Sample Text File"...
0
by: JosAH | last post by:
A Simple Text-Based Menu System Read this this post; there are numerous posts like that: a newbie struggling with some sort of menu implementation. They want nested menus of course and an option...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.