Hide background Image

Posted on 2007-10-15
Last Modified: 2008-01-09
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,
Question by:JoeBo747
    LVL 26

    Assisted Solution


    if (Option1.Value = true) then
    Image1.Visible = false
    elseif (Option2.Value = true) then
    Image1.Visible = true
    end if
    LVL 1

    Author Comment

    Hi EDDYKT,

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


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

    Thanks again,
    LVL 96

    Assisted Solution

    by:Bob Learned
    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.

    LVL 2

    Accepted Solution


    Try this:

    Dim img As Image = New Bitmap("option1.bmp")
    If (Option1.Value = true) Then
              GroupBox1.BackgroundImage = img
              GroupBox1.BackgroundImage = Nothing
    End If
    LVL 1

    Author Comment

    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,

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now