Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ImageList Control - KeyExists() procedure
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
ImageList Control - KeyExists() procedure
Miscellaneous
Thread ID:
00662237
Message ID:
00662237
Views:
59
Anyone know quick way to determine if a key exists in an ImageList control?

Tried to do the following but getting the error message "OLE IDispatch exception code 0 from ListImages: Element not found.."
loImage = toImageList.ListImages(lcIconKey)

IF NOT VARTYPE(loImage)='O'
  Add new image...
ENDIF
My other choice is as follows but the code is called many times and itterating through the collection very call seems a bit much
llImageExists = .F.
FOR EACH loImage IN toImageList.ListImages
  IF loImage.KEY = lcIconKey
    llImageExists = .T.
  ENDIF
ENDFOR

IF NOT llImageExists
  Add new image...
ENDIF
Heavy Metal Pedal - click with care
Next
Reply
Map
View

Click here to load this message in the networking platform