[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ON COM                   Trap for Communications Activity

 ON COM(n) GOSUB {linenum | linelabel}

    Specifies a subroutine to which QuickBASIC will branch if it detects
    activity at a specified communications port. The trap must also be
    turned on by means of a COM(n) ON statement.

           n    A numeric expression. Must be either 1, for COM1:, or 2,
                for COM2:.

     linenum    The first line of a communications-handling subroutine.
                Setting linenum to 0 disables trapping.

   linelabel    A label identifying the first line of a communications-
                handling subroutine.

   -----------------------------------------------------------------------

      Notes:    {linenum | linelabel} must be defined at the main program
                level.

                With communications trapping in effect, QuickBASIC checks
                for data at the specified communications port. When
                activity is detected, QuickBASIC branches to the specified
                subroutine and temporarily suspends trapping (by means of
                an implicit COM(n) STOP statement). Trapping automatically
                resumes when a RETURN from the communications-handling
                subroutine is executed (unless the communications-handling
                routine explicitly performs a COM(n) OFF or COM(n) STOP).

                All event trapping is temporarily disabled when QuickBASIC
                is executing an error-handling routine (established via an
                ON ERROR statement).

                If the "Checking Between Statements" option is in effect,
                QB checks for communication activity after each statement.
                If the "Event Trapping" option is selected, QB checks
                after each new program line. If neither option is
                selected, no trapping takes place.

                For command-line compilation, /v enables checking after
                each statement, and /w enables checking after each new
                line. If neither switch is used, no trapping takes place.

See Also: COM(n)
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson