Image List Control

Adding Images

Firstly, we need to add some images to the ImageList control. To do this, right click on the ImageList control that you have added to the form, and click Properties. The Property Pages for the ImageList control will now appear:

Click on the Images tab, and click Insert Picture. There are a number of standard toolbar buttons provided with Visual Basic. Browse to %VBInstallationPath%CommonGraphicsBitmapsTlBr_W95. This path may differ depending on where VB is installed, and if you have the whole of Visual Studio installed. If you can't find it, simply use the Windows search tool to find the folder TlBr_W95. 

You can insert more than one image at a time, so, simply select a few of the BMP files in the TlBr_W95 folder, using the Shift and Ctrl keys, and click Open. You will now see that they are shown under the label Images in the Property Pages. 

If you get an error saying "ImageList cannot be modified while another control is bound to it", select the last image, and then add the images. This error occurs because another Common Control is using the Images in the ImageList control (called being bound), and therefore you can only add images to the end. Also, once the ImageList is bound to another control, you cannot delete any images. If you need to do this, select the control that is bound to it, and change its ImageList property to <None>. Make the changes you want to the ImageList, and bind it again.

Now you need to set the keys for each of the images. Select the first image, and type some text in the Key field to identify it. For example, if it is a picture of the 'Copy' image, enter copy. It is a good idea to use the same case for all the keys (ie all uppercase or all lowercase), because it is case-sensitive. Enter keys for all the other images you have added, and click OK. 

You have now successfully added some images to the ImageList control.

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.

“In order to understand recursion, one must first understand recursion.”