April 27, 1999

Use the right type for constants

VB stores symbolic and literal constants internally using the simplest data type possible; this means that most common numeric constants-such as zero or one-are stored as Integers. If you use

Use Sleep API to add pauses to your programs

Don’t use an empty For…Next loop to add pauses to your programs; instead, use the Sleep API function, that releases the CPU and lets other apps in the system effectively

GoSub are slower in compiled programs

In VB applications compiled as native code, GoSubs are 5-6 times slower than calls to regular Subs or Functions; conversely, in p-code they are considerably faster. This is one of

Upgrade to the most recent Service Pack

OK, this is a silly suggestion, but I personally know a lot of developers that complain about Visual Basic’s bugs that were fixed in more recent Service Packs. This is

And is faster the Mod

Use the And operator instead of Mod when the divisor is a number in the form 2^N. For instance, there are two methods to extract the least significant byte in

Always declare objects with full library name

If your application uses objects from external components, either third-party or your own libraries, a good rule of thumb is to include the complete servername.classname string in the Dim statement,