Solved

Close 2 Forms on Exit

Posted on 2006-10-30
7
186 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 142

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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 142

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

747 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

10 Experts available now in Live!

Get 1:1 Help Now