Microsoft KB Archive/47754
Article ID: 47754
Article Last Modified on 11/21/2006
This article was previously published under Q47754
The documentation incorrectly states that you can "...safeguard your program from user errors such as string input when a numeric value is expected..." in the following manuals:
- "Microsoft QuickBasic 4.0: Programming in Basic: Selected Topics" manual for Versions 4.00 and 4.00b, Page 279
- "Microsoft QuickBasic 4.5: Programming in Basic" manual for Version 4.50, Page 225
- "Microsoft Basic Compiler 6.0: Programming in Basic: Selected Topics" for Microsoft Basic Compiler Versions 6.00 and 6.00b, Page 279
This documentation error is not present in Microsoft Basic PDS Version 7.00.
It is not possible to use the ON ERROR GOTO statement to trap the "Redo from Start" error that occurs for the INPUT statement when a string is entered and a numeric value is required. To avoid the "Redo from Start" error message, you must use a different form of input, such as the LINE INPUT statement or the INKEY$ function.
Because LINE INPUT accepts all characters until it encounters a carriage return, you must parse the input string yourself using string manipulation (e.g. MID$, INSTR) and type conversion (e.g. VAL).
For a code example of a line-input routine using the INKEY$ statement, query on the following words:
INKEY$ and CTRL+BREAK and DEBUG and GOSUB
Additional query words: QuickBas BasicCom