Solved

Close 2 Forms on Exit

Posted on 2006-10-30
7
190 Views
Last Modified: 2008-03-10
Hey guys

Ive got a formA that has a button that fires another form (reference Card) . I want to close both formA and formReference when formA is exited. Cant seem to get it right.

Thanks
0
Comment
Question by:stephenz43
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 12

Expert Comment

by:Mamtha1982
ID: 17832212
If FormA if startup form, then you can write Me.Close() or End in FormA to close all forms.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17832221
0
 

Author Comment

by:stephenz43
ID: 17832248
formA is not a startup form nor a parent
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17832259
>Ive got a formA that has a button that fires another form
that means that formA is the "parent" of the other one...
I guess a confusion of terms here.

As formA fires the other form, it should have/retain that form's reference. and using that, it can close it also at any time.
0
 
LVL 12

Accepted Solution

by:
Mamtha1982 earned 500 total points
ID: 17832264
try this..

Dim f As New formReference

Sub Button_Click(.................)
f.Show()
End Sub

Form1_FormClosing(.................)
     f.Close()
End Sub
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17843205
Bit late but you can lop through the My.Application.OpenForms and close them fromt he main form.
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17843207
"Loop"
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

679 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