Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1310
The tools collection has not been initialized.
posted

I am attempting to build some Ribbon Tab Groups programatically.

Getting an error  inserting the tool in the group. 

            Dim Tab1 As RibbonTab = Me.URM_INet.Ribbon.Tabs.Add("Tab1")
            Dim Group1 As RibbonGroup = New UltraWinToolbars.RibbonGroup("Group1")

            Group1.Key = "G1"
            Tab1.Groups.Add("Group1")
            Group1.Tools.InsertTool(0, "Review Commissions")   <----Error "The Tools  collection has not been initialized."

what am i  missing?

 

Also,  the tools that I want to insert were created in the Infragistics Ribbon Customize screen.   Is this the Tools Collection? Tools Base?

How can I create a new tool in that "Tools Collection" using VB?

 

Parents
  • 44743
    Verified Answer
    posted

    The problem here is that Group1 is never added to the RibbonTab. You create an instance of a RibbonGroup, then set its Key to a new value, then add a new group to the RibbonTab with the key of "Group1" (the Add method taking a string creates a new RibbonGroup). Group1 still belongs to now RibbonTab, so you cannot add tools to it. Use this code instead:

    Dim Tab1 As RibbonTab = Me.URM_INet.Ribbon.Tabs.Add("Tab1")
    Dim Group1 As RibbonGroup = Tab1.Groups.Add("Group1")
    Group1.Tools.InsertTool(0, "Review Commissions")

Reply Children