advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
RUN Statement Details
  Summary  Details  Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 RUN [linenumber | filespec$]
 
 Usage Notes
   ■ The line where execution begins must be at the module level of a
     non-form code module. No executable statements are allowed at the
     module level of a form module.
 
   ■ A RUN statement in a SUB or FUNCTION procedure must point to a line
     label at the module level. If no line label is given, execution always
     starts with the first executable line of the main module.
 
   ■ The .BAS extension is assumed in the programming environment; however,
     Visual Basic assumes the .EXE extension for compiled, stand-alone
     programs. If the program you want to run has a different extension, you
     must supply the extension. If the program name has no extension, the
     file name given must end with a period. For example:
 
         RUN "CATCHALL"
 
     executes CATCHALL.EXE from a BC-compiled program, and executes
     CATCHALL.BAS within the Visual Basic programming environment.
 
   ■ Program lines can have line numbers or alphanumeric labels. For
     example:
 
         OpenWindow:
 
     However, the RUN statement does not accept an alphanumeric label. If an
     alphanumeric label is the target of a RUN statement, Visual Basic
     generates the error message, "Type mismatch."
 
   ■ Programs running within the Visual Basic programming environment
     (VBDOS.EXE) must call only Basic program files (.BAS). The file is
     loaded and run as if it were a Basic program; if it is not in the Basic
     program format, execution halts. The error message that appears varies,
     depending on the file's contents. Likewise, programs compiled with BC
     must not invoke Basic source files (.BAS), since these files run only
     in the programming environment.
 
   ■ An executable file need not have been written in Basic. Any executable
     file can be run - for example, files with the extensions .COM and .EXE.
 
   ■ When a program is running in the Visual Basic programming environment,
     if a .BAS file matching the file name in the command line cannot be
     found, Visual Basic generates the error message, "File not found," and
     control returns to the programming environment.
 
   ■ When running a program compiled by BC, Visual Basic generates the error
     message, "File not found in module program name," and control returns
     to the operating system.
 
   ■ When the invoked program completes execution, control does not return
     to the invoking program. If the invoking program is run outside Visual
     Basic, control returns to the operating system. If the invoking program
     is run under the Visual Basic programming environment, control returns
     to the programming environment.
 
   ■ RUN closes all files and clears program memory before loading the
     designated program. If you want to run a different program, but leave
     open files open, use the CHAIN statement. See: CHAIN Statement