Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

null string$

Status
Not open for further replies.

pan1

Programmer
Oct 26, 1998
1
0
0
US
I am a beginner and need some help.<br>
I am trying to have an input var$ that they didn't enter anything for to tell them thsy must enter something.<br>
This how i have it but it doesn't work:<br>
IF mail.nam = "" THEN GOTO 2410 <br>
Can you help?????<br>
Paul
 
If you use the Var mail.nam then you shouldn´t use "" cause you<br>
are using an Integer with an String where "" is you string<br>
better use 0 (zero)<br>
Doc DooM
 
I think DocDoom is right, try testing for 0 instead of null.<br>
Pan1, why are you using line numbers? The fact that QBasic allows alpha labels makes the language more usable than the original BASIC.<br>
<br>

 
MIght try this...I'm not *proficient* with QB though...so I might have a few syntax problems...will try to error-shoot this one b4 clicking submit:<br>
<br>
DIM xxx as STRING<br>
xxx = ""<br>
DO while xxx = ""<br>
input "question",xxx<br>
LOOP<br>
<br>
<br>
This *SHOULD* keep prompting the user with "question" indefinately until they give you an answer. GOOD LUCK!<br>
<br>
<br>
-Robherc
 
You might want to try this one to.<br><br>1:<br>CLS<br>LOCATE 13,30<br>INPUT &quot;*question*&quot;,mail.nam$<br>IF mail.nam$ = &quot;&quot; THEN GOTO 1
 
hey! that will put pan1 in a never-ending loop. Not fair, kreep!<br> <p> <br><a href=mailto: > </a><br><a href= temporary Vorpalcom home page</a><br>Send me suggestions or comments on my current software project.
 
(Programmer)&nbsp;&nbsp;Apr 8, 2000<br>hey! that will put pan1 in a never-ending loop. Not fair, kreep!<br><br>Only until mail.nam$ has a non-null value . . . ??
 
It'll send it to 1: only if nothing is added you can also add this if you want the &quot;user&quot; to know why it's asking again:<br><br>1:<br>CLS<br>LOCATE 13,30<br>INPUT &quot;*question*&quot;,mail.nam$<br>IF mail.nam$ = &quot;&quot; THEN <br>DO<br>PRINT &quot;Please answer the Question&quot;<br>LOOP WHILE INKEY$ &lt;&gt; &quot;&quot;<br>END IF<br>GOTO 1<br>
 
kreep (Apr 15, 2000)<br><br>That code will definitely make his head spin--in an infinate loop that is.&nbsp;&nbsp;Think you should move the &quot;GOTO 1&quot; line up one (1) line so that it is executed in the IF..THEN statement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top