Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 21, 1997

Clean and Compact Your Code

The last thing you should do before creating your final EXE is clean your code. This tip explains how to clean the garbage from your project that is sometimes left behind from moving procedures in and out of different project files. Doing so will make your project files smaller and, in some cases, eliminate possible GPFs due to code being left behind by only deleting a pointer to the code. This routine works for forms and module files. Start Visual Basic and load your project. Make sure that all your code windows are closed. Highlight the first file in your project window. Then select Save Text from the File menu. Click on OK to save the file in text format. Highlight the same file in the project window. Click on the View Code button in the project window. Select Load Text from the File menu. Find and highlight the previously saved file (FormName.txt). Click on Replace. Finally, close the code window. Repeat the same steps for each file in the project and then save your project. This procedure will remove the transparent dead code left over from deleting code or moving procedures in and out of different project files. You will be able to see the results in the size of your project files after you run this routine for each file in your project and save your project. This cleaning can also prevent GPFs that are caused sometimes by this transparent dead code. This routine does not remove code that is moved to the general declaration section of a file because you changed a control's name. It removes old data you thought you deleted, but you actually deleted only a reference pointer to it. The code is still there, but it is transparent in the code windows.
Stefan Klein
 
Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date