Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
menu structure is as follows:

1. Root
1.1 File
1.1.1 Save
1.1.2 Export
1.1.3 Exit
1.2 Tools
1.2.1 Support
1.2.1.1 Bank
1.2.1.2 Currency
1.2.1.3 ------
1.2.1.4 Ref Table
1.2.1.5 Payment Method

This is how am accessing menu items but not able to access sub items of the same..
BindingList Titles = new BindingList(); 
Titles = _FrmTitleMan.GetFormMenu(Program.UserTypeID); 
foreach (ToolStripMenuItem mainmenu in menuStrip.Items) 
   { 
   foreach (ToolStripItem item in mainmenu.DropDownItems) 
      { 
      foreach (FrmTitlesInfo frmtitle in Titles) 
         { 
         if (item.Name == frmtitle.Frmmenu) 
            item.Visible = false; 
         } 
      }

I want to access
C#
1.2.1.4 Ref Table
1.2.1.5 Payment Method

these sub menus, how can i access it..

[edit]Code fragment indented instead of on single line - OriginalGriff[/edit]
Posted
Updated 13-Mar-12 23:22pm
v5
Comments
Sergey Alexandrovich Kryukov 13-Mar-12 1:54am    
The problem is not clear. If you created such menu, it all yours, everything is accessible by definition. :-) What's the problem?
--SA
codeBegin 13-Mar-12 2:02am    
What more clarification you want sir,
This is how am accessing menu items but not able to access sub items of the same..

BindingList<frmtitlesinfo> Titles = new BindingList<frmtitlesinfo>();
Titles = _FrmTitleMan.GetFormMenu(Program.UserTypeID);

foreach (ToolStripMenuItem mainmenu in menuStrip.Items)
{
foreach (ToolStripItem item in mainmenu.DropDownItems)
{
foreach (FrmTitlesInfo frmtitle in Titles)
{
if (item.Name == frmtitle.Frmmenu)
item.Visible = false;
}
}

Now is it clear?
Or else tell me what more should i explain to you
Prasad_Kulkarni 13-Mar-12 2:07am    
Hey just chill
why you din't posted your code in your question itself. The code always makes question clear. That's what our experts expect.
Sergey Alexandrovich Kryukov 14-Mar-12 2:39am    
Good idea (OP should use "Improve question" where the code should also be formatted), but why saying "just chill". OP is doing fine, just needs to explain what's the problem and then possibly get some help.
--SA
Prasad_Kulkarni 14-Mar-12 5:21am    
Got it sir,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900