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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing all images from an imagelist programatically. 1

Status
Not open for further replies.

wraygun

Programmer
Dec 9, 2001
272
US
I've written a little app that allows the user to load any bitmap as their cursor. I'm using an imagelist to store the pic, then extracticon to change the cursor. The problem is, I have to manually remove the loaded pictures from the imagelist. How do I clear the imagelist programatically?

Thanks,
Wraygun

***You can't change your past, but you can change your future***
 
The Clear method seems to work okay:

Private Sub Form_Load()
Dim img As ListImage

NameEm
Set img = ImageList1.ListImages.Add(, "keyTest", LoadPicture("C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Misc\FACE01.ico"))
NameEm
Command3.Picture = ImageList1.ListImages("keyTest").ExtractIcon
ImageList1.ListImages.Clear
NameEm
End Sub

Public Sub NameEm()
Dim img As ListImage
Dim str As String

For Each img In ImageList1.ListImages
str = str & img.Key & vbCrLf
Next img

MsgBox str
End Sub

Regards,

Andy

"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
 
Thanks for the star!

Regards,

Andy

"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
 
No problem my friend.

I appreciate the prompt assistance I recieve on this forum.

Wraygun

***You can't change your past, but you can change your future***
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top