Solved

get list of menuStrip in list view

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Service Controller 1 23
HttpPostedFile 1 26
VB.NET - Error - Object not set in Module 4 33
Obtain cell value using column ID in DataGrid using VB.NET 2 16
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…
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.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

815 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now