Probably - assuming that they are linked to your form:
MenuStrip menu = form.MainMenuStrip;
if (menu != null) {
WalkItems(menu.Items);
}
...
static void WalkItems(ToolStripItemCollection items) {
foreach (ToolStripItem item in items) {
// do something with this item
Console.WriteLine(item.ToString());
// enumerate sub-items (if could have them)
ToolStripDropDownItem dropItem = item as
ToolStripDropDownItem;
if (dropItem != null) {
WalkItems(dropItem.DropDownItems);
}
}
}
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.