Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add images at runtime to Imagelist

Status
Not open for further replies.

access97to2000

Programmer
Aug 12, 2002
45
US
Hi,
how can i add images to a imagelist at runtime ?
i tried this way, but its giving me a "Type mismatch" error:

Dim mgx As Integer
Dim abc As String
mgx = ImageList1.ListImages.Count
abc = CStr(App.Path & "\images\firewo.ico")
Set imgx = ImageList1.ListImages.Add(, , abc)

mgx is giving me the number of images already there in imagelist
but the set imgx .... part is giving me error. please help me out.
thanks
rk
 

Yours

Set imgx = ImageList1.ListImages.Add(, , abc)

From VB Help

The ListImages collection is a 1-based collection.
You can load either bitmaps or icons into a ListImage object. To load a bitmap or icon, you can use the LoadPicture function, as follows:

Set imgX = ImageList1.ListImages.Add(,,LoadPicture("file name"))

You can also load a Picture object directly into the ListImage object. For example, this example loads a PictureBox control's picture into the ListImage object:

Set imgX = ImageList1.ListImages.Add(,,Picture1.Picture)


Hope this Helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top