10-27-2023, 07:19 PM
The code is intended to work as follows: when only the Enter key is pressed, the variable (H#) cannot be set to zero. However, when the zero (0) key is pressed, the variable (H#) is supposed to have a zero value. But if the entered number is 1,2,3,4,5,6 digits, it is to be confirmed with the Enter key. However, the 7-digit number is to be approved automatically.
To sum up, the entered numbers may have the following values: 0, 11, 232, 1254, 36547, 325478, 3254657.
H$ = "": B$ = ""
WHILE LEN(H$) < 7 AND B$ <> CHR$(13)
B$ = ""
WHILE B$ = "": B$ = INKEY$: _LIMIT 30: WEND
IF B$ = CHR$(27) THEN 4200
IF B$ = CHR$(32) THEN 8425
IF B$ = CHR$(45) THEN 6171
IF B$ = CHR$(43) THEN 6172
IF B$ = CHR$(81) OR B$ = CHR$(113) THEN 6304
IF B$ = CHR$(65) OR B$ = CHR$(97) THEN 6305
IF B$ = CHR$(87) OR B$ = CHR$(119) THEN 6306
IF B$ = CHR$(83) OR B$ = CHR$(115) THEN 6307
IF B$ = CHR$(69) OR B$ = CHR$(101) THEN 6308
IF B$ = CHR$(68) OR B$ = CHR$(100) THEN 6309
IF B$ = CHR$(82) OR B$ = CHR$(114) THEN 6310
IF B$ = CHR$(70) OR B$ = CHR$(102) THEN 6311
IF B$ <> CHR$(13) THEN H$ = H$ + B$
WEND
H# = VAL(H$): PRINT H#
Thank you for your help - regards
To sum up, the entered numbers may have the following values: 0, 11, 232, 1254, 36547, 325478, 3254657.
H$ = "": B$ = ""
WHILE LEN(H$) < 7 AND B$ <> CHR$(13)
B$ = ""
WHILE B$ = "": B$ = INKEY$: _LIMIT 30: WEND
IF B$ = CHR$(27) THEN 4200
IF B$ = CHR$(32) THEN 8425
IF B$ = CHR$(45) THEN 6171
IF B$ = CHR$(43) THEN 6172
IF B$ = CHR$(81) OR B$ = CHR$(113) THEN 6304
IF B$ = CHR$(65) OR B$ = CHR$(97) THEN 6305
IF B$ = CHR$(87) OR B$ = CHR$(119) THEN 6306
IF B$ = CHR$(83) OR B$ = CHR$(115) THEN 6307
IF B$ = CHR$(69) OR B$ = CHR$(101) THEN 6308
IF B$ = CHR$(68) OR B$ = CHR$(100) THEN 6309
IF B$ = CHR$(82) OR B$ = CHR$(114) THEN 6310
IF B$ = CHR$(70) OR B$ = CHR$(102) THEN 6311
IF B$ <> CHR$(13) THEN H$ = H$ + B$
WEND
H# = VAL(H$): PRINT H#
Thank you for your help - regards