CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2002
    Location
    Central Indiana
    Posts
    4

    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.
    Peace from the Pup
    "Don't get burned, debug to death"

  2. #2
    Join Date
    Jul 2003
    Location
    I'm Here!
    Posts
    31
    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.

  3. #3
    Join Date
    Jan 2002
    Location
    Central Indiana
    Posts
    4
    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.
    Peace from the Pup
    "Don't get burned, debug to death"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured