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.
ENDDOC, NEWPAGE, and PRINT Methods Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
' This example illustrates the use of the ENDDOC, PRINT, and NEWPAGE methods.
' ENDDOC is used to end a document after printing via the PRINT method. Two
' pages are printed (NEWPAGE), each with a centered line of text indicating
' the page number. Note: You must have a printer connected to LPT1: and it
' must be turned on before running this example.
'
' To try this example:
' 1. Choose New Project from the File menu
' 2. Choose New Form from the File menu to create a form
' 3. Press Alt+F4 to return to the programming environment
' 4. Copy the code example below to the form module
' 5. Press F5 to run the example
DECLARE SUB PrinterDemo ()
SUB Form_Click ()
CALL PrinterDemo
END SUB
SUB PrinterDemo ()
ON LOCAL ERROR GOTO ErrorHandler ' Set up error handler
Msg$ = "This is printed on page"
FOR I% = 1 TO 2 ' Set up two iterations
PRINTER.PRINT Msg$ ' Print
PRINTER.NEWPAGE ' Send new page
NEXT I%
PRINTER.ENDDOC ' Print done
Msg$ = "Two pages, each with a single, centered line of text, "
Msg$ = Msg$ + CHR$(10) + CHR$(13) + "have been sent to your printer."
MSGBOX Msg$ ' Display message
EXIT SUB
ErrorHandler:
MSGBOX "There was a problem printing to your printer."
EXIT SUB
END SUB