Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which form didn't close?

Status
Not open for further replies.

JFoushee

Programmer
Oct 23, 2000
200
US
Hello.
I have a number of forms on some program.

Through a certain combination of Cancel, OK, Cancel, etc...
when I close the original program, VB6 does not immediately go back into debug mode.
It sits there with the Pause and Stop buttons activated.

I have a feeling I didn't close out a form.

Is there a way I can tell what form didn't close?
The Call Stack is disabled during this limbo state.
Or am I on the wrong track?
 
Also, are you sure you are always unloading the closed forms and not just hiding them?
-Max
 
No DoEvents.
As far as unloading forms, I'm pretty good about following a
Code:
Form1.Close: Set Form1 = Nothing

I was hoping to find some Public Sub, whereby I could pause the program at any given time and display all the active forms.
Code:
Public Sub sub_Return_Forms
  Dim myForm As Form
  For Each myForm in Forms
    Debug.Print myForm.Name & vbtab & myForm.Visible
  Next
End Sub
The above keeps barking back:
Compile Error: Expected Function or variable
 
I think I got it: on my original Form's Unload routine, I call the sub above. I see the forms that haven't closed.
 
This may not be exactly what you are looking for, but I usually use this in the "main" form's queryunload event to unload all the app's forms that may be open:
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Dim frm         As Form
    For Each frm In Forms
        Unload frm
    Next
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top