Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Jul 27, 1998



Application Security Testing: An Integral Part of DevOps

Closing an application

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?

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

   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)

   End Sub
DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date