Guides & Tutorials (beta)

Hiding a ToolBar

by Mike Palmatier Visual Basic 6 Created on 01/31/2008  |  Updated on 07/30/2024 0/5 ( 0 votes )

To access the ToolBars via code, the CommandBars collection is used. The CommandBars collection is a collection of CommandBar objects. The collection will contain a CommandBar object for each toolbar that is created. The collection is a "1" based collection and the first CommandBar in the collection will always be the ActiveMenuBar, which is the menu displayed at the top of your application. The second CommandBar in the collection will be the First ToolBar that was created, the third CommandBar in the collection will be the Second ToolBar created, etc.

To hide a ToolBar, you simply use the index that corresponds with the ToolBar you want to hide to the CommandBars collection to access the Visible property of the ToolBar and set it to False. This will only hide the ToolBar and not delete it.

The user can also hide a ToolBar when it is floating by clicking on the "close" button as shown in the picture below. The user can also hide or display ToolBars by right-clicking on any toolbar. This will display a Context Menu that contains a list of all the ToolBars and allows them to be hidden or displayed. See the Removing ToolBars from the Context Menu article for more details.

Close Toolbar

The code below will hide the first toolbar.

CommandBars(2).Visible = False

User Comments

No comments yet, sign in to comment.

Secure Transactions

Online transactions are secure and protected.


Ssl seal 1
This site is protected by Trustwave's Trusted Commerce program
CompliAssure Secured

Money Back Guarantee

If you are not 100% happy with your purchase within 30 days, you can return it for any reason. Your satisfaction is our priority!


Satisfication Guarantee

Contact sales@codejock.com for more details.