Jump to content
xisto Community
Sign in to follow this  
ViRuaL

Visual Basic: Unload Your Application Correctly!

Recommended Posts

What many of us do not know is that using a button on a form with the function "Unload Form1" or even clicking the X in the upper right corner is like pulling the plug out of your computer while it is still on. It may not exit the program cleanly and efficiently, may leave background processes running, or just give you unwanted errors by exiting improperly.

 

All you need to do is unload all components, forms, controls, etc. upon unloading. Say you have 2 forms in your project, 1 component, and 2 controls. If these ojects are placed onto a form, unload them properly! For instance-

 

Private Sub Form_Unload()Unload Form1Unload Form2Unload Component1Unload Control1Unload Control2End Sub

This will make sure that all objects are properly unloaded instead of "dumping" them when you exit the program.

 

Hope this helped you.

Share this post


Link to post
Share on other sites

Thanks for this tip. I have just finished a Clinical Database Management Software for GPs and forgot to include this feature. Now I have rectified it and thanks again-****.Tracy007

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.