Search code examples
c#toolstrip

How do I use an item that's a child of a toolstrip item?


Ok, so this is somewhat confusing, so bear with me.

I have a toolStrip item called "Downloads". When (and this is 100% random) a new item is added (it occurs when a website that I have no control over). I want to be able to read every item in the subset "Downloads" (so it's this.ToolStrip.Downloads.ITEM), one at a time, and use it. How do I do this?


Solution

  • From the image it appears you are adding your download items to a ToolStripMenuItem. A ToolStripMenuItem has a DropDown property that in turn has an Items collection property. You can use the Items collection the same as any other to add, remove, etc. your downloads.

    Downloads.DropDown.Items.Add("A File");