|
-
Jul 8th, 2005, 12:52 PM
#1
[RESOLVED] How to check if an Image is in an Imagelist?
How do I check if an image has been added to an imagelist?
I assign a Key to each one.. and need to check by key.
Is there an easier way than looping through checking each key?
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 8th, 2005, 12:53 PM
#2
Re: How to check if an Image is in an Imagelist?
 Originally Posted by [LGS]Static
Is there an easier way than looping through checking each key?
Not that I'm aware of.
-
Jul 8th, 2005, 01:10 PM
#3
Re: How to check if an Image is in an Imagelist?
ok.. I'll leave it open for a bit in case someone knows.. but for now thats what I'll use
Thanks Hack!
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 8th, 2005, 01:36 PM
#4
Re: How to check if an Image is in an Imagelist?
One option, although I don't think its any easier than a loop. How hard is it to code a loop?
VB Code:
Public Function ImageExists(ImageListCtl as ImageList, ByVal ItemKey As String) As Boolean
On Error Resume Next
Dim objItem As ListImage
Set objItem = ImageListCtl.ListImages(ItemKey)
ImageExists = Not objItem Is Nothing
End Function
-
Jul 8th, 2005, 01:44 PM
#5
Re: How to check if an Image is in an Imagelist?
VB Code:
Dim iFound As Boolean
iFound = False
For i = 1 To IL_Code.ListImages.Count
If IL_Code.ListImages(i).Key = strKey Then
iFound = True
Exit For
End If
Next
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 8th, 2005, 01:49 PM
#6
Re: How to check if an Image is in an Imagelist?
I like yours better.. since I have to test in multiple places I swiped you function and replaced mine 
Thanks!
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|