If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Posts: 2
Joined: Fri Feb 04, 2011 2:17 pm


Post by hubert »

I have been working on making modules and since I haven't seen any information on it I thought I would post this information which I have learned by trial and error.

If anyone has anything to add or to clarify please do.

The ?File? section has three buttons for making modules.
1. Save All; 2. Make a File 3. Load a File

To start a Module:
Press ?Make a File? in the ?File? section. Then Name the Module.
Use ?New Sub? to put subs in the Module. And press ?Save All?.
When you ?SaveAll? all the DECLARE SUBS in all modules will be done automatically.
The added module will only have the shared subs. The Main module will have all subs.
This is done automatically after ?Save All?
Can?t duplicate names.

To Share variables:
The COMMON and the COMMON SHARED are used to share variables between modules.
COMMON cat$,dog$
COMMON count%, total%
They have to be put into both the main module and the added module.
The COMMON SHARED is used when sharing variables in a sub and between modules.
Arrays are done differently
They have to be DIM SHARED and the DIM SHARED has to be placed before the COMMON.
DIM SHARED horse$(400)
COMMON horse$()
Post Reply