Skip to main content

Posts

Showing posts from September, 2010

C# Windows, Iterate through Menu Items (MenuStrip)

for (int i = 0; i < this.menuStrip1.Items.Count; i++) { //main menus items string mnuItemName = this.menuStrip1.Items[i].Name; ToolStripMenuItem tmpMenuItem = this.menuStrip1.Items[i] as ToolStripMenuItem; //check for sub menu for (int j = 0; j < tmpMenuItem.DropDownItems.Count; j++) { string menuSubItem = tmpMenuItem.DropDownItems[j].Name; } }