Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 76,180 times

Contents

Related Categories

Image List Control - Using the images

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.

James first started writing tutorials on Visual Basic in 1999 whilst starting this website (then known as VB Web). Since then, the site has grown rapidly, and James has written numerous tutorials, articles and reviews on VB, PHP, ASP and C#. In October 2003, James formed the company Developer Fusion Ltd, which owns this website, and also offers various development services. In his spare time, he's a 3rd year undergraduate studying Computer Science in the UK. He's also a Visual Basic MVP.

Comments

  • Visual Basic

    Posted by Anuradha on 23 Jul 2002

    I am new to VB and I am sort working thru exercises in a book

    I came across one that has me a bit stuck
    It basically says to create a form with two ImageList Controls ,add the images to one con...

  • Posted by battleangel444 on 18 Apr 2002

    hey i hope this helps i was tryin to do the same thing you were tryin to do and i stuble upon your topic, try using this

    ImageList1.ListImages.Add ImageList1.ListImages.count + 1, , LoadPicture(txt...

  • dynamically populating imagelist

    Posted by theoskii on 09 Apr 2002



    I am very new to VB and I am sort working thru exercises in a book

    I came across one that has me a bit stuck
    It basically says to create a form with two ImageList Controls populate the first ...