Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

get list of menuStrip in list view

Posted on 2014-04-21
2
Medium Priority
?
268 Views
Last Modified: 2014-12-01
i want to give user permission of menuStrip items

so i want list of menuStrip items in list view

in c#
0
Comment
Question by:ajaymaster1558
[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
2 Comments
 
LVL 7

Accepted Solution

by:
Utkarsh Kulkarni earned 2000 total points
ID: 40012571
Hi,

You can use following

List<ToolStripMenuItem> _lstItems = new List<ToolStripMenuItem>();
foreach (ToolStripMenuItem _tsmItem in menuStrip.Items)
{
    _lstItems.Add(_tsmItem);
    //add sub items
    _lstItems.AddRange(GetTSMItems(_tsmItem));
}  
private IEnumerable<ToolStripMenuItem> GetTSMItems(ToolStripMenuItem _tsmBaseItem)
{
    foreach (ToolStripMenuItem _tsmItem in _tsmBaseItem.DropDownItems)
    {
        if (_tsmItem.HasDropDownItems)
        {
            foreach (ToolStripMenuItem _tsmSubItem in GetItems(_tsmItem))
                yield return _tsmSubItem;
        }
        yield return _tsmItem;
    }
}

Ref - http://stackoverflow.com/
0
 

Author Closing Comment

by:ajaymaster1558
ID: 40473437
thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

715 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