Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dynamic Menu in Windows C# Application

Posted on 2006-07-20
1
Medium Priority
?
521 Views
Last Modified: 2008-01-09
In my c# windows application, I have created 10 drop down menu's, mnuFile0, mnuFile1, ...., mnuFile9.  I've read in a field from a db and wish to update the .Text items of the drop down menu's to the contents of the db field.  In action script, this would be the way (using eval command):

for (i=0; i<9; i++) {
    MenuItem mnu = Eval("mnuFile" + i);
    mnu.Text = DBRecordField[i];
    mnu.Visible = True;
}

After spending some time researching FindControl(ID) only to realize this was for web pages, is there a C# windows application equivelant to Eval?  Somehow I get the feeling there isn't, is there another way?

Many thanks.
0
Comment
Question by:daviesgroup
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
sumix earned 1000 total points
ID: 17147146
your 10 menuitems should be part of a MenuItems collection of a Mainmenu or other menuitem control, can't you just loop this collection?

for (int i=0;i<menuItem1.MenuItems.Count;i++)
// or for (int i=0;i<mainMenu1.MenuItems.Count;i++)
{
   menuItem1.MenuItems[i].Text = DBRecordField[i];
 }
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question