troubleshooting Question

VB6 - why is Sub MDIForm_Load() being called when I terminate my program?

Avatar of LeighWardle
LeighWardleFlag for Australia asked on
Visual Basic Classic
2 Comments1 Solution1093 ViewsLast Modified:
Hi,

I am using some code (snippet below) from this webpage (see below "Avoid the End Statement"):
http://www.pgacon.com/visualbasic.htm

But I have been debugging this code, and I have just noticed that the Sub MDIForm_Load() is being called.
That doesn't seem right to me.

Regards,
Leigh
Public Sub TerminateProgram()
 
Static Unloading As Boolean
Dim idx As Integer
 
If Unloading Then Exit Sub
Unloading = True
 
For idx = Forms.Count - 1 to 0 Step -1
    Unload Forms(idx)
Next idx
 
Unloading = False
 
End Sub
ASKER CERTIFIED SOLUTION
GrahamSkan
Retired
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros