Image List Control

Using the images

Once you have added the images, you will want a control to use them! To do this, select the control you want to use the images (this has to be another Common Control, ie TreeView, ListView, Toolbar etc), and show the Property Pages (right click and select properties). Find the ImageList drop down box, and choose the ImageList you want to use. If you are using the ListView control, then click the ImageLists tab, and select the ImageList from one of the drop downs (you can use different image lists for the large icons, small icons and column headers). 

Now, for the Toolbar, simply go to the button you want in the Property Pages, and set its Image property to the Key of the Image you want:

If you want to use an ImageList on another form, you have to set the Image List and Image properties at Runtime. Below is some example code:

Set Toolbar1.ImageList = frmOther.imlIcons
With Toolbar1
    .Buttons("Curve").Image = "Curve"
    .Buttons("Save").Image = "Save"
End With

This code sets Toolbar1's image list to the imlIcons ImageList on frmOther. It then sets the Images to use for the buttons Curve, and Save.

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.

“There are only 3 numbers of interest to a computer scientist: 1, 0 and infinity”