# VB 6 Tool Bar

The VB 6 allows you to add a toolbar to the form object. In this article we will explain the method to add the toolbar .

To create a toolbar you have to follow steps given below.

• Add component, “Microsoft Windows Common Control 6.0″
• Select Toolbar control from the Toolbox in VB 6 IDE.
• Configure Toolbar buttons with Caption and Key properties.
• Write code for Toolbar and its buttons.

Now, we will follow the steps above and create a toolbar for the VB 6 form object.

Step 1: Add Microsoft Windows Common Control 6.0

For this step, go to Project tab in your VB 6 IDE, select Components. It will open up the components window.

You should see the following window.

In the components window, select “Microsoft Windows Common Control 6.0” and you will add Toolbar control to the toolbox.

Step 2 – Select Toolbar Control from toolbox

Select the Toolbar from toolbox in VB 6 IDE. See the following figure below.

Step 3: Configure the Toolbar control buttons

You need to go to toolbar properties to add buttons to the toolbar. Right click on the toolbar and click Properties.

Once the toolbar property is open, select the Buttons tab and click Insert to add new button. Here you can change the index value, you can give new caption to the buttons, given a key value.

The key value is important to access the toolbar button and give it some action once the button is clicked. We will see the next step.

Step 4: Add code for the buttons

You have to add some code for the toolbar, so that, when you click the button, some action take place.

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

Select Case Button.Key

Case "File":
MsgBox "This is File"
Case "Edit":
MsgBox "This is Edit"
End Select

End Sub

## Output: Toolbar

#### Visual Basic 6 For Dummies 1st Edition

Create your own custom Visual Basic programs fast for Windows 95, Windows 98, and Windows NT!

If you want to develop business applications for Windows, then Microsoft’s Visual Basic 6 programming environment is for you. With its powerful and friendly object-oriented interface, Visual Basic 6 is the ideal tool for creating easy-to-use and attractive interfaces of your own. Whether you want to build original programs from the ground up or take advantage of existing wizards, Visual Basic 6 For Dummies will help you design and debug your work – and accomplish all your goals!

• Covers using Visual Basic 6 with Windows 95, Windows 98, and Windows NT
• Walks you through the ins and outs of object-oriented programming in Visual Basic and using the Visual Basic toolset
• Shows you how to make use of menus and submenus, write subprograms that everyone can share, save and retrieve information in databases, integrate ActiveX controls into your applications, and build attractive user interfaces with buttons, boxes, and scroll bars

From the fundamentals of writing BASIC code to the thrill of distributing your very own custom applications, Visual Basic 6 For Dummies brings a fresh perspective to programming in Visual Basic 6 that everyone can understand.