devxlogo

Tip Bank

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.

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

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

Checking for a Previous Instance

When working in Windows, it is very easy to lose a minimized icon onthe desktop. Or you may forget you have an application running and tryto open it again from

Data Updating Speed

When updating the values of several records in a loop, put a BeginTrans,CommitTrans around the loop. This will significantly speed up the updateprocess: BeginTrans Do Until dsData.EOF dsData.Edit dsData!sState_cd =