Question:
When I press the Close button on my app’s main form, the program appears to end. When I look at the Windows task list, however, my app is still there. How can I correct this so that when I click the Close button the program completely closes down?
Answer:
You’ve probably forgotten to unload one or more of your app’s forms. Try adding the following code to your main form’s Unload event:
Private Sub Form_Unload(Cancel As Integer) Dim frm As Form For Each frm In Forms Unload frm Next End Sub
The above code won’t work in VB3, but you can do this instead:
Sub Form_Unload(Cancel As Integer) Dim I As Integer For I = Forms.Count - 1 To 0 Step -1 Unload Forms(I) Next End Sub