Closing a Form from another Form

I have an application with 2 panels.
Left panel contains navigation and the right panel contains a toolstrip on which MDI tabs are placed.

I want to allow the user to open as many windows as they want with the only limitation being they can only open ONE of each.

So when Btn1 is pressed for example i check a boolean to see if its open or not. If it is it tells its already open and cant be opened twice, if not it opens. thats easy.

My problem is disposing of each form and clearing the resources. I have added a sub to each form called KillForm() which disposes of everything on each form. But how can i call this sub from the mainForm? this is my code so far attached below.

This wont work because diary doesnt exist as a form when im writing my code. Is there anyway around this?
Private Sub TabStrip1_TabRemoved(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabStrip1.TabRemoved
        If TabStrip1.SelectedTab.Text = "My Diary " Then
            'dispose of all objects and close form
            'set diary open to false
            diaryOpen = False
        End If
    End Sub

Open in new window

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.

David L. HansenCEOCommented:
I'd place your KillForm() routine in a module and have the routine accept a form as a parameter.

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
drews1fAuthor Commented:
ahh im new and never thought of that! but that should work!!
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.NET

From novice to tech pro — start learning today.