devxlogo

April 27, 1999

Use integer division operator

Use “” instead of “/” when performing divisions between Integers. The “/” operator returns a Single value, therefore the seemingly efficient line C% = A% / B% actually requires three

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

GetShortFileName – Convert a filename to 8.3 format

Private Declare Function GetShortPathName Lib “kernel32” Alias _ “GetShortPathNameA” (ByVal lpszLongPath As String, _ ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long’ Convert a long filename into the

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,