Microsoft KB Archive/22022

From BetaArchive Wiki
Knowledge Base


PRINT Forces Contiguous String to Next Row & Doesn't Wrap It

Article ID: 22022

Article Last Modified on 11/21/2006

This article was previously published under Q22022

SUMMARY

The PRINT statement displays a contiguous string constant on the next row below the current print position (without breaking or wrapping the string) if printing it from the current screen column exceeds the 80th column.

This behavior is by design. You will need to break the string into a piece small enough to fit within the space before the 80th column to avoid forcing the whole string to the next line (see example below).

MORE INFORMATION

This standard behavior occurs in most retail Microsoft Basic versions for MS-DOS, including the following products:

  1. QuickBasic Compiler (Versions 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50) for MS-DOS
  2. Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and OS/2
  3. Microsoft Basic Professional Development System (PDS) Version 7.00 for MS-DOS and OS/2
  4. GW-Basic Versions 3.20, 3.22, and 3.23

The following is a code example:

   5  CLS
   10 LOCATE 1,1    ' LOCATEs in column 1.
   20 PRINT "LOCATED ON ROW 1, THIS STRING STAYS ON ROW 1."
   30 LOCATE 2,70    ' LOCATEs in column 70, leaving no room.
   40 PRINT "DESPITE BEING LOCATED ON ROW 2, THIS PRINTS ON ROW 3"
   50 LOCATE 4,71   ' To make it wrap, break up the string as follows:
   60 PRINT "1234567890";"THIS STARS IN COLUMN 1"
                


Additional query words: QuickBas BasicCom

Keywords: KB22022