Visual Basic Tip: 04/01/96

Short Tips: IIF, Option Explicit, Command$, CR$, Usenet .

- "file not found" error when you distribute a program
    Check to see if you use the IIF function.  The IIF function requires
    the file MSAFINX.DLL to be distributed with your application.  This
    is not mentioned in the documentation or the setup wizard.

- Option Explicit

   The Option Explicit statement is used in the Declarations section of a
   form or module to force explicit declaration of all variables for that
   form or module.  If you don't use the Option Explicit statement, all
   undeclared variables are of Variant data type.

   Main Benefits:
    * Minimize the quantity of bugs introduced in code by misspelling a
      variable name.
    * Speed/Optimization.  All of the declared variable types run faster
      and use less memory than the default variant type.

- Command, Command$ Function

   Returns the argument portion of the command line used to launch the
   program.  Example: Use the Command$ function to return the file name
   to open when a user clicks on the associated file type that launches
   your application.

- Adding a new line in Message Box text, text box, ...

   You need to add a carriage return and a line feed (CR and LF are
   ASCII characters 13 and 10 respectively).  

    CR$ = Chr$(13) & Chr$(10) 
    Text1 = "First Line" & CR$ & "Second Line"

- Usenet newsgroups relating to Visual Basic.  Excellent places to ask
  and give advice relating to Visual Basic programming!


Return to Phil's Web Page

Created by: Philip