@Chris what do you want to happen when someone just hits the enter key, no number started?
If you don't want zero what do you want? an error message? and empty string? just ignore? You didn't say.
And really you might just code it yourself, in fact code each scenario for practice.
IF B$ = CHR$(13) AND H$ = "" THEN ' do what you want!
We got most of work done for you already, be a coder yourself
Also YOU CAN make this a little fancier by adding a backspace button so a person can edit es number before it is "returned".
Oh I should warn if H$ = "" empty string then Val(H$) = 0 automatically unless you tell it to do something else for H$ = "" before VAL(H$)
Update I like all if's under one roof, it's more efficient:
I chose BEEP when H$="" and B$ = enter
If you don't want zero what do you want? an error message? and empty string? just ignore? You didn't say.
And really you might just code it yourself, in fact code each scenario for practice.
IF B$ = CHR$(13) AND H$ = "" THEN ' do what you want!
We got most of work done for you already, be a coder yourself
Also YOU CAN make this a little fancier by adding a backspace button so a person can edit es number before it is "returned".
Oh I should warn if H$ = "" empty string then Val(H$) = 0 automatically unless you tell it to do something else for H$ = "" before VAL(H$)
Update I like all if's under one roof, it's more efficient:
Code: (Select All)
H$ = "": B$ = ""
While Len(H$) < 7
Locate 1, 1: Print Spc(8)
Locate 1, 1: Print H$
B$ = ""
While B$ = ""
B$ = InKey$
_Limit 30
Wend
If B$ = Chr$(27) Then
End
ElseIf B$ = "-" Then
If H$ = "" Then H$ = "-" Else Beep
ElseIf InStr("0123456789", B$) Then
H$ = H$ + B$
ElseIf B$ = Chr$(13) And H$ = "" Then
Beep
ElseIf B$ = Chr$(13) And H$ <> "" Then
Exit While
End If
_Limit 30
Wend
H! = Val(H$): Print "H ="; H!
b = b + ...