Form not unloading after assigning a picture to an Image control

My About box's Form_Load contains the following line of code:

imgIcon.Picture = frmMain.Icon

to display main form's icon in an Image control. When I close the dialog and then close my program, the About box is not unloaded, so the program does not really end. I've commented out that line and then the program ends correctly. The same happens with PictureBox controls. Any hints?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

to ensure you are closing all forms do this:

Private Sub Form_Unload(Cancel As Integer)
    Dim frm As Form
    For Each frm In Forms
        If frm.hWnd <> Me.hWnd Then _
            Unload frm
    Unload Me
End Sub

luisrAuthor Commented:
That would do it, but I still want to know why the form is still loaded after a call to Unload Me.

BTW, I'm using VB 5.0.
I would imagine because he is referencing the icon from your main form which is not unloaded yet.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

luisrAuthor Commented:
I tried imgIcon.Picture = LoadPicture() before unloading the form and it did not work.
try this:

Set imgIcon.Picture = Nothing
luisrAuthor Commented:
It does not work.
why dont you just do as i stated earlier and close all the forms?  are you saying that you close the about box and then close the main form and then the about box form suddenly reappears?
Guy Hengel [angelIII / a3]Billing EngineerCommented:
You line
imgIcon.Picture = frmMain.Icon
will load the form "frmMain" (into memory), in order to be able to access the icon data.
So it is the frmMain that remains loaded, not the About form!
If you want to unload that form, you need to add a line like
Unload frmMain
immediately after your first line.

Hope this illuminates you

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
luisrAuthor Commented:
You're right angelIII, it's frmMain that remains in memory. Although your solution works (unloading frmMain), I did something else. I changed my code to copy the icon from the global variable fMainForm, which is an instance of frmMain.

Thanks for the tip!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.