Microsoft KB Archive/31821

= Structured Programming in Microsoft QuickBasic - Modules =

Article ID: 31821

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBASIC 4.0b

-



This article was previously published under Q31821



SUMMARY
Easy modular programming is possible with Microsoft QuickBasic by using separately compiled modules. Basic programs no longer have to be developed as one large program; they can be written as separate, functionally grouped sets of subroutines that can be used in other programs.

A module consists of an optional &quot;main program&quot; and a set of subprogram procedures. Data can be passed between linked modules by using subprogram parameters or named COMMON SHARED blocks. The named COMMON SHARED statement allows different groups of variables and arrays to be shared among the various modules in a single program. An example of a common block named GRAF3D is shown below: DIM TRANSFORM3D(3,3) 'static array passed in COMMON COMMON SHARED /GRAF3D/ CURX, CURY, CURZ, TRANSFORM3D



MORE INFORMATION
The SHARED attribute of the COMMON statement shares that COMMON among all subprogram procedures in that particular module. The variables in a COMMON without the SHARED attribute are only available at the main program level.

An unnamed (blank) COMMON statement can pass information between CHAINed programs. (Named COMMON blocks are not carried across when you CHAIN to another QuickBasic .EXE program.)

Subprograms, separate compilation, COMMON blocks, and program CHAINing make Microsoft QuickBasic a useful language for developing large application systems.

Additional query words: QuickBas

Keywords: KB31821

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.