|
-
May 2nd, 2008, 05:52 PM
#1
Thread Starter
Hyperactive Member
[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
-
May 2nd, 2008, 06:24 PM
#2
Addicted Member
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
-
May 2nd, 2008, 06:54 PM
#3
Thread Starter
Hyperactive Member
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
-
May 2nd, 2008, 06:57 PM
#4
Addicted Member
Re: PictureBox Problem
Did you try the BringToFront method?
-
May 2nd, 2008, 08:47 PM
#5
Thread Starter
Hyperactive Member
Re: PictureBox Problem
Hello ThatSamiam,
Yes, I did try that, still no change.
Rgds,
Tarablue
-
May 3rd, 2008, 02:51 AM
#6
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|