Solved

get list of menuStrip in list view

Posted on 2014-04-21
2
258 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 500 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

626 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