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
215
Error in adding/deleting objects in Control Container
posted

Hi,

I'm working on a application menu which uses 2 UltraExplorerBars. The first one has Outlook Navigation Pane style. The second one has ExplorerBar style, and is displayed in the ControlContainer of the first one, as shown below:

All groups for both ExplorerBars are created at runtime via code. When you click a bouton in the NavigationOverflowButtonArea of the 1st ExplorerBar (highlighted in green), the groups and items of the 2nd ExplorerBar are then created and the ExplorerBar is added to the ControlContainer of the 1st ExplorerBar, as you can see in the yellow area. This is done by the method

     groupLevel1(counter).Container.Controls.Add(UltraExplorerBarLevel2)

 

When you click the button highlighted in red, the first level menu change. All the groups are deleted, and the control container is cleared:

     groupLevel1(counter).Container.Controls.Clear()

     UltraExplorerBarLevel1.Groups.Clear()

So it works fine the first time I click the "switch" button, as you can see in the right screenshot. But when I click again, to retrieve the state you can see in the left screenshot, I have the message "System.ObjectDisposedException: Cannot access a disposed object", when the program is trying to do:

     groupLevel1(counter).Container.Controls.Add(UltraExplorerBarLevel2)

So if someone understands my problem and can help me, it would be very nice.

Regards.

Olivier FALCY.

 

Parents Reply Children
No Data