advr.hlp (Topic list)
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.
KEY Statement (Assignment) Details
  Summary  Details  Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 KEY {key%, stringexpression$ | LIST | ON | OFF}
 
 Usage Notes
   ■ References to the KEY LIST or KEY ON statement are not allowed when
     forms are showing and cause Visual Basic to generate an error. Use the
     HIDE method to hide any visible forms or controls before executing
     either of these statements. See: HIDE Method
 
   ■ Use the KEY statement to designate special "soft-key" functions - that
     is, strings that are returned when function keys are pressed.
 
   ■ Assigning a null string to a soft key disables the function key as
     a soft key.
 
   ■ If stringexpression$ is longer than 15 characters, the extra
     characters are ignored.
 
   ■ If the function-key number is not in the correct range, Visual Basic
     generates the error message, "Illegal function call," and the previous
     key string expression is retained.
 
   ■ You can display soft keys with the KEY ON, KEY OFF, and KEY LIST
     statements:
 
         Statement      Action
         ═════════      ════════════════════════════════════════════════════
         KEY ON         Displays the first five to six characters of the
                        soft-key string values on the bottom line of the
                        screen.
         KEY OFF        Erases the soft-key display from the bottom line,
                        making that line available for program use. It does
                        not disable the function keys.
         KEY LIST       Displays all soft-key values on the screen, with all
                        15 characters of each key displayed.
 
   ■ If a soft key is pressed, the effect is the same as if the user typed
     the string associated with the soft key.
 
   ■ INPUT$, INPUT, and INKEY$ all can be used to read the string produced
     by pressing the soft key.