Articles in this section
Category / Section

How to retrieve the Items collection of the ToolStripTabItems and QuickAccessPanel Items in WinForms RibbonControlAdv?

1 min read

Retrieve the items collection of ToolStripTabItems

We can access the ToolStripTabItems collection through the RibbonControlAdv.Header.MainItems property. The QuickAccessPanel items can be retrieved from the RibbonControlAdv.Header.QuickItems property.

C#

private void buttonAdv1_Click(object sender, EventArgs e)
{
    foreach (ToolStripItem toolStripItem in this.ribbonControlAdv1.Header.QuickItems)
    {
        listBox1.Items.Add(toolStripItem.Text.ToString());
    }
    foreach (ToolStripTabItem toolStriptabItem in this.ribbonControlAdv1.Header.MainItems)
    {
        listBox2.Items.Add(toolStriptabItem.Text.ToString());
    }
}

VB

Private Sub buttonAdv1_Click(ByVal sender As Object, ByVal e As EventArgs)
    For Each toolStripItem As ToolStripItem In Me.ribbonControlAdv1.Header.QuickItems
        listBox1.Items.Add(toolStripItem.Text.ToString())
    Next toolStripItem
    For Each toolStriptabItem As ToolStripTabItem In Me.ribbonControlAdv1.Header.MainItems
        listBox2.Items.Add(toolStriptabItem.Text.ToString())
    Next toolStriptabItem
End Sub

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied