How to hide and show ToolBar using Button or Event?

Add-in Express™ Support Service
That's what is more important than anything else

How to hide and show ToolBar using Button or Event?
Vadim Usmanov

Posts: 18
Joined: 2012-03-23
My question is: how to hide and show ToolBar using Button or Event?

I can hide ToolBar using Button_Click but only if the code inside the ToolBar-module (MyIEToolBar1):

    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
           Me.Visible = False 
    End Sub

How can I call a procedure hide/show ToolBar from another module or for instance from IEModule_BeforeNavigate2 Event?

I have not found a way.

Thanks in advance.
Posted 23 Mar, 2012 14:46:20 Top
Vadim Usmanov

Posts: 18
Joined: 2012-03-23
The problem is solved.

I took example from

and use the Module property of my toolbar to get the corresponding IE module.

This is my code (may be useful to someone):

Private Sub AdxieContextMenu1_OnClick(sender As System.Object, htmlElement As System.Object) Handles AdxieContextMenu1.OnClick
        '24.03.12 Hide/show ToolBar from IEModule
        Dim ToolbarObject As MyIEToolbar1 = CType(Me.AdxieToolBarItem1.ToolBarObj, MyIEToolbar1)

        If ToolbarObject.Visible = True Then
            ToolbarObject.Visible = False
            ToolbarObject.Visible = True
        End If
    End Sub
Posted 24 Mar, 2012 06:16:25 Top
Andrei Smolin

Add-in Express team

Posts: 17178
Joined: 2006-05-11
Hello Vadim,

Thank you for posting the code. Here's what we included into the manual:

Calling a method defined in an ADXIEToolbar from the IE Module
Dim toolbarItem As AddinExpress.IE.ADXIEToolBarItem = Me. ToolBars(0)
Dim toolbarObj As AddinExpress.IE.ADXIEToolbar = toolbarItem. ToolBarObj
Dim myToolbar As MyIEAddon1.MyIEToolBar1 = _
    CType(toolbarObj, MyIEAddon1.MyIEToolBar1)

AddinExpress.IE.ADXIEToolBarItem toolbarItem = this.ToolBars[0];
AddinExpress.IE.ADXIEToolbar toolbarObj = toolbarItem.ToolBarObj;
MyIEAddon1.MyIEToolBar1 myToolbar = toolbarObj as MyIEAddon1.MyIEToolBar1;

Hope this helps.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 26 Mar, 2012 02:54:25 Top