Results 1 to 6 of 6

Thread: [RESOLVED] PictureBox Problem

  1. #1

    Thread Starter
    Hyperactive Member Tarablue's Avatar
    Join Date
    Feb 2007
    Location
    Somewhere West of GMT
    Posts
    398

    Resolved [RESOLVED] PictureBox Problem

    Hello All,

    I have 2(two) PictureBoxes, one on top of the other - both with a different image that is set in the Properties window. What I need is that when my program returns a number if that is below the threshold then PictureBox1 is shown and PictureBox 2 is not.

    Now I have tried;

    If x < 10 then
    PictureBox1.Visible = True
    PictureBox2.Visible = False
    else
    PictureBox2.Visible=True
    PictureBox1.Visible = False
    end if

    PictureBox2 is always shown. If I set both to Visible=False in the Properties window neither are shown.

    Surely this is a pretty simple thing to do, so why won't it work?

    Rgds
    Tarablue

  2. #2
    Addicted Member ThatSamiam's Avatar
    Join Date
    Apr 2007
    Posts
    128

    Re: PictureBox Problem

    Pictures are kinda funny. When I have trouble with pictures displaying, I rebuild the project. If that does not work, I close and re-open VB.

    That said, this works for me:

    Code:
        If x < 10 Then
          PictureBox1.BringToFront()
        Else
          PictureBox2.BringToFront()
        End If

  3. #3

    Thread Starter
    Hyperactive Member Tarablue's Avatar
    Join Date
    Feb 2007
    Location
    Somewhere West of GMT
    Posts
    398

    Re: PictureBox Problem

    Hello ThatSamiam,

    You got that right, they are funny little buggers, it used to OK work in VB6.

    Yeh I tried that and still Pic2 stays on top.

    I offset the two PictureBoxes and went back to the Visible thing, and both showed up. Even with setting the PictureBox Background to Transparent you cannot see the other PictureBox behind, it is covered up by the top one, with the Form background color showing.

    I did try using a Panel, but that had the same problem.
    Rgds,
    Tarablue

  4. #4
    Addicted Member ThatSamiam's Avatar
    Join Date
    Apr 2007
    Posts
    128

    Re: PictureBox Problem

    Did you try the BringToFront method?

  5. #5

    Thread Starter
    Hyperactive Member Tarablue's Avatar
    Join Date
    Feb 2007
    Location
    Somewhere West of GMT
    Posts
    398

    Re: PictureBox Problem

    Hello ThatSamiam,

    Yes, I did try that, still no change.

    Rgds,
    Tarablue

  6. #6

    Thread Starter
    Hyperactive Member Tarablue's Avatar
    Join Date
    Feb 2007
    Location
    Somewhere West of GMT
    Posts
    398

    Re: PictureBox Problem

    Hello ThatSamiam,

    Ha, got it! I had my code in the Calling form along with all my other data and NOT in the receiving form. Now it works just fine with the BringToFront idea.

    Thanks.
    Tarablue

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