Microsoft QuickBASIC 4.5 Learning Guide (Microsoft Press, 1988). Use when writing BASIC code for QuickBASIC 4.5, MS-DOS, structured BASIC programming, SUB/FUNCTION procedures, variables, arrays, loops, file I/O, debugging, screen output, or retro DOS BASIC development. Covers BASIC fundamentals, the QuickBASIC IDE, menus, windows, smart editor, on-line help, debugging, executable creation, and the QCARDS tutorial project.
Publisher: Microsoft Corporation, 1988 Source: Microsoft Programmer's Library 1.3 via PCjs
Official tutorial and reference for the Microsoft QuickBASIC 4.5 environment, covering BASIC language fundamentals, the QuickBASIC IDE, structured programming with procedures, and a hands-on tutorial building the QCARDS database application.
QB ' Start QuickBASIC
QB program.bas ' Start and load a program
QB /RUN program.bas ' Start, load, and run a program
QB /B ' Black-and-white monitor mode
QB /H ' High-resolution display (43/50 lines)
QB /G ' Faster screen updates (CGA)
QB /NOHI ' Disable high-intensity characters
QB /L libraryname ' Load a Quick library
QB /AH ' Allow dynamic arrays of records >64K
QB /MBF ' Microsoft Binary Format for MKSNGL$/MKSMBF$
F5 Run/Continue program
F8 Single step (into procedures)
F10 Procedure step (over procedures)
F9 Toggle breakpoint
F4 View output screen
F6 Switch between windows
F1 Context-sensitive help
SHIFT+F1 General help
ALT+F1 Previous help screen
F2 SUBs dialog (view/switch procedures)
SHIFT+F5 Restart program
CTRL+BREAK Stop running program
' --- Variables and Types ---
DIM x AS INTEGER ' Integer (2 bytes, -32768 to 32767)
DIM y AS LONG ' Long integer (4 bytes)
DIM z AS SINGLE ' Single precision (4 bytes)
DIM d AS DOUBLE ' Double precision (8 bytes)
DIM s AS STRING ' Variable-length string
DIM f AS STRING * 20 ' Fixed-length string (20 chars)
DEFINT A-Z ' Default all variables to INTEGER
' --- Arrays ---
DIM Scores(1 TO 100) AS INTEGER
DIM Grid(10, 10) AS SINGLE
REDIM DynamicArray(n) AS INTEGER ' Dynamic (resizable) array
' --- User-Defined Types ---
TYPE Person
Name AS STRING * 30
Age AS INTEGER
Salary AS SINGLE
END TYPE
DIM emp AS Person
' --- Control Flow ---
IF condition THEN
' statements
ELSEIF condition THEN
' statements
ELSE
' statements
END IF
SELECT CASE expression
CASE value1
' statements
CASE value2 TO value3
' statements
CASE IS > value4
' statements
CASE ELSE
' statements
END SELECT
FOR i = 1 TO 100 STEP 2
' statements
NEXT i
DO WHILE condition
' statements
LOOP
DO
' statements
LOOP UNTIL condition
' --- Procedures ---
SUB MySub (param1 AS INTEGER, param2 AS STRING)
' statements
END SUB
FUNCTION MyFunc% (x AS INTEGER)
MyFunc% = x * 2
END FUNCTION
CALL MySub(5, "hello") ' Call a SUB
result% = MyFunc%(10) ' Call a FUNCTION
' --- Screen Output ---
CLS ' Clear screen
PRINT "Hello, World!" ' Print to screen
PRINT USING "##.##"; 3.14 ' Formatted output
LOCATE row, col ' Position cursor
COLOR foreground, background ' Set text colors
' --- File I/O ---
OPEN "data.dat" FOR OUTPUT AS #1
PRINT #1, "Hello"
CLOSE #1
OPEN "data.dat" FOR INPUT AS #1
INPUT #1, text$
CLOSE #1
OPEN "data.dat" FOR RANDOM AS #1 LEN = LEN(record)
PUT #1, recnum, record
GET #1, recnum, record
CLOSE #1
' --- Error Handling ---
ON ERROR GOTO ErrorHandler
' ... code ...
ErrorHandler:
PRINT "Error"; ERR
RESUME NEXT