Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Selecting Images for Display (VB 6.0)

    I have several images on a form that initially have Visible = False., e.g. Image1, Image2, etc. Within the code I generate a single digit string containing the image number, i.e. 1 or 2, etc. How do I generate the code necessary to turn an image ON? For example, I can create a string such as strImage = "Image2" but how do I then convert that to the code expression Image2.Visible = True and execute it?

    I hope the above is understandable.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Selecting Images for Display (VB 6.0)

    You can use Me.Controls("Image2").Visible = True, so if you create a string variable strImage with value "Image2", this will work:

    Me.Controls(strImage).Visible = True

  3. #3
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Selecting Images for Display (VB 6.0)

    Thanks Hans, That seems to work OK.

Posting Permissions

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