-
Testing Image Path
I've searched through these forums for about a week and I have not been able to find anything about this.
I've got a Image that loads with the path App.Path & "open.bmp"
The picture loads find into the Image control. Now I want to test the path of the Image when I click on it. If the path is open.bmp, I want it to change to closed.bmp. When I run the code below, it errs at the If statement, stating a Type Mismatch. It is probably something simple that I am missing.
If imgLight(Index).Picture = App.Path & "open.bmp" Then
imgLight(Index).Picture = LoadPicture("closed.bmp")
End if
Any help is appreciated, its been bugging me for a while now.
-
If you only have one Image Control, you don't need to reference it using an index. You only need to index the image list contained therein:
Try something like
imgLight.ListImages(Index).Picture =
Also, your if statement is wondering what you want. Try something like:
If imgLight.ListImages(Index).Tag = "open.bmp" Then
That is assuming you assigned it a name of open.bmp when you loaded it to begin with.:rolleyes:
-
I'm not sure what an Image Control is. Do I have to load the bitmaps into the list before the program runs?
Also, I inserted your revised If statement and it didn't run. It gives me a compile error. "Method or data member not found"
If you would like, I can upload the vb files if you want to look at them.
Thanks for the help.