Hide background Image

Hi Experts,

I have an option group with a background image, how do I hide the image if option 1 is selected and show the image if option 2 is selected?

Thanks again,
Joe
LVL 1
JoeBo747Asked:
Who is Participating?
 
CuSo4Connect With a Mentor Commented:
Hi,

Try this:

Dim img As Image = New Bitmap("option1.bmp")
If (Option1.Value = true) Then
          GroupBox1.BackgroundImage = img
Else
          GroupBox1.BackgroundImage = Nothing
End If
0
 
EDDYKTConnect With a Mentor Commented:
?

if (Option1.Value = true) then
Image1.Visible = false
elseif (Option2.Value = true) then
Image1.Visible = true
end if
0
 
JoeBo747Author Commented:
Hi EDDYKT,

Thanks for your response, the image is a background image on the groupbox control and does not expose a visible property!

Me.GroupBox1.BackgroundImage.visible

I have tried dispose but this throws an error. The image is in the project resources folder.

Thanks again,
Joe
0
 
Bob LearnedConnect With a Mentor Commented:
You are going to have to keep an image in memory, and then set the BackGroundImage to Nothing, and reset the BackGroundImage back to the image.

Bob
0
 
JoeBo747Author Commented:
Hi  CuSo4, TheLearnedOne, EDDYKT,

All three of you have supplied helpful input, thank you; I have added extra points to try and reflect this and split them between you.

Thanks again,
Joe
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.