We help IT Professionals succeed at work.

Close 2 Forms on Exit

stephenz43
stephenz43 asked
on
Medium Priority
207 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
Comment
Watch Question

Praveen KumarArchitect

Commented:
If FormA if startup form, then you can write Me.Close() or End in FormA to close all forms.
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:

Author

Commented:
formA is not a startup form nor a parent
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
>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.
Architect
Commented:
try this..

Dim f As New formReference

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

Form1_FormClosing(.................)
     f.Close()
End Sub

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Bit late but you can lop through the My.Application.OpenForms and close them fromt he main form.
"Loop"
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.