LOCATE and PRINT with Semicolon on Line 25 to Avoid Scrolling (76560)



The information in this article applies to:

  • Microsoft QuickBASIC 4.0, when used with:
    • the operating system: MS-DOS
  • Microsoft QuickBASIC 4.0b, when used with:
    • the operating system: MS-DOS
  • Microsoft QuickBASIC 4.5, when used with:
    • the operating system: MS-DOS
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.1

This article was previously published under Q76560

SUMMARY

On most PC systems, sending output to the last line of a text mode screen will cause the display to scroll. For example, if you are in 25-line mode, output on line 25 ending in a carriage return plus linefeed will cause the screen to scroll up one line.

To send output to the last line of a text screen in a Basic program, you can use the LOCATE statement to locate the cursor on the last line of the display, then PRINT the output, ending the PRINT statement with a semicolon (;) to suppress the carriage return plus linefeed that Basic normally appends to each PRINT statement.

This information applies to Microsoft QuickBasic versions 4.0, 4.0b, and 4.5 for MS-DOS and to Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 for MS-DOS and MS OS/2.

MORE INFORMATION

Example

CLS
WIDTH 80, 25        'Sets display to 25-line mode.
PRINT CHR$(201);
PRINT STRING$(78, 205);
PRINT CHR$(187);
FOR count% = 2 TO 24
      LOCATE count%, 1
      PRINT CHR$(186);
      LOCATE count%, 80
      PRINT CHR$(186);
NEXT
LOCATE 25, 1            'This puts you on line 25.
PRINT CHR$(200);        'The semicolon prevents you from scrolling.
PRINT STRING$(78, 205);
PRINT CHR$(188);
SLEEP
END
				

Modification Type:MinorLast Reviewed:1/9/2003
Keywords:KB76560