How to loop through all ribbon tabs, ribbon bar and items on WinForms Ribbon

Posted by: serjaime on 9 May 2018, 12:08 pm EST

    • Post Options:
    • Link

    Posted 9 May 2018, 12:08 pm EST

    Hello,

    I would like enable/disabled buttons from Ribbon where it contain varios RibbonTabs, RibbonGroup al many button.

    The idea is check all buttons name and compare it with a Table_Profile to enable/disable according users rights, but I try without success . Can you help me pls ?

    I used the code without success :

    For Each Tab As C1.Win.C1Ribbon.RibbonTab In Rb.Tabs

    For Each Group As C1.Win.C1Ribbon.RibbonGroup In Tab.Groups

    For Each Button As C1.Win.C1Ribbon.RibbonButton In Group.Name

    If Button.Name = “test” Then Button.Enabled = True

    Next

    Next

    Next

  • Posted 9 May 2018, 1:21 pm EST

    Hello,

    Finally I fixed it as :

    For Each Tab As C1.Win.C1Ribbon.RibbonTab In Rb.Tabs

    'MsgBox(Tab.Name.ToString)

    For Each Group As C1.Win.C1Ribbon.RibbonGroup In Tab.Groups

    'MsgBox(Group.Name.ToString)

    For Each Button As C1.Win.C1Ribbon.RibbonButton In Group.Items

    'MsgBox(Button.Name.ToString)

    If Button.Name = “Button_Name_From_BBDD” Then Button.Enabled = True

    Next

    Next

    Next

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels