August 20, 1997

DevX - Software Development Resource

In-Line Code

Calling a function or procedure incurs some overhead. If you have atwo-line function that is called from only three places, you might considerputting those three lines in the functions themselves

DevX - Software Development Resource

Use Specific Object Types

When passing controls as parameters, make the function that is receivingthe parameter accept the specific object type instead of generic types.The exception to this is when multiple types of objects

DevX - Software Development Resource

Set AutoRedraw to False

If AutoRedraw is set to True, VB keeps a bitmap of the form in memorythat it uses to redraw the form after another window in front of it isclosed. Because

DevX - Software Development Resource

Use VB’s Timer Function to Optimize Code

I often see questions in the VBPJ forum about comparative speedsfor different methods of performing actions in code. In many cases, a simplegeneralization of which is fastest cannot be made.

DevX - Software Development Resource

Clear Out Data When Unloading Forms

When unloading a form, use the following piece of code behind a Closebutton: Unload This code should also be put in the Form_Unload() event handlerfor that form: Set = Nothing

DevX - Software Development Resource

Using ALT+F4

Pressing Alt and F4 will close any window with a control box. Becauseyou can’t choose Alt and F4 as a shortcut key combination from the menudesigner, you must place it