• 0

Question involving If/Case in VB


Question

Since I'm a bit tired ATM, I'll ask here instead of trying blind, but is it possible to do a casewhere/if statement that will perform an action based on a picturename that is loaded in an image box? I'm going to make an interface where several clear labels are overlaid on a picturebox, to create a Myst like point and click interface, but easily. If I may write in pseudocode a bit...

Casewhere imgImageView.picture is:

Room1.jpg : set matrix commands to perform actions specific to room1

Room2.jpg : set matrix commands to perform actions specific to room2

Room3.jpg : set matrix commands to perform actions specific to room3

End Case

etc, etc...

Any ideas?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

I assume you're talking about VB 6, because .net has the Image box instead. But basically, you're using the Picture property, which is an Image object. That image object should have an ImageName property (or maybe Path) which will give you a string representation of the picture name. Use that instead. Again, I'm not sure how much is the same in VB 6 :D

Link to comment
Share on other sites

  • 0

No it's not possible, at least not that way. The .picture property is an image, not the location of an image. So you wouldn't be able to tell if it was room1, room2 or room3.

There doesn't seem to be any property which holds the filename either.

What you do is create a varialbe that holds the room number, then when you are setting the picture, add another line of code which records what picture is displayed.

Then you use this on your labels instead...

Casewhere Variable is:

1 : set matrix commands to perform actions specific to room1

2 : set matrix commands to perform actions specific to room2

3 : set matrix commands to perform actions specific to room3

End Case

Edited by elliot
Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.