Toolbar Control

Using Images

So far the toolbar doesn't really look like a toolbar at all, because it doesn't have any pictures. You can add these using an ImageList control. First, add an ImageList control to the form, and add 3 icons to it (you can use the Open, Save and New bitmap files in the CommonGraphicsBitmapsTlBr_W95 folder where VB is installed, or download the Editing icons from our Icon Library), and set their keys to Open, Save and New too.

Now we have an image list with some images in it, we need to associate it with the Toolbar. To do this, return to the Toolbar property window, and in the ImageList drop down, select the name of the ImageList control. Now, go to the Buttons tab. You will notice that the Image box is now enabled. In that box you can either enter the Index or the Key of the image you want displayed. It is usually a good idea to use the Key because that is more meaningful than just a miscellaneous number. So, for the Open button, enter 'Open' in the Image box (because Open is the key of the icon we want to use in the ImageList). Then, do the same for the other buttons. That's all there is too it.

Now, you're toolbar will be looking much more like a toolbar!

You might, at this stage decide that you don't want the text displayed below the icon. If this is the case, simply set the Caption property to nothing for the 3 buttons.

You might also like...

Comments

About the author

James Crowley

James Crowley United Kingdom

James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audien...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debuggers don't remove bugs. They only show them in slow motion.”