drews1f
asked on
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?
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
diary.killForm()
'set diary open to false
diaryOpen = False
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER