Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 24th, 2003, 09:41 AM
doltmann's Avatar
doltmann doltmann is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Waco TX (The land of the lost)
Posts: 17 doltmann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to doltmann
QBasic...

I know that this is WAY old... but im doing it for a class...

This isnt the complete code, because theres way more to be done... but im having problems with this...

nameInput$ = "filler"

CLS

DO UNTIL nameInput$ = ""
GOSUB inputInfo
dataString$ = dataString$ + nameInput$ + "," + piecesInput$ + ","
LOOP

dataString$ = dataString$ + "END,0"

GOSUB inputdata

DO UNTIL UCASE$(name$) = "END"
GOSUB displayData
LOOP

END

inputInfo:
INPUT "Name: ", nameInput$
INPUT "Pieces: ", piecesInput$
RETURN

displayData:
PRINT name$, pieces$
READ name$, pieces$
RETURN

inputData:
READ name$, peices$
DATA dataString$
RETURN



This returns on the READ statement, in "inputData" sub, that it is Out of DATA....

Anyone have any idea as to what may be going on?

Reply With Quote
  #2  
Old September 24th, 2003, 10:37 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
dataString$ is a variable value,not two variable value..U must have two value to give the name$ and Peices$..
When Data statement has little value than variable in the read statement,Out of Data error happened..

Reply With Quote
  #3  
Old September 24th, 2003, 10:40 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
U can try Set statement:set a$="123"
__________________
Being a Code Headman !

Reply With Quote
  #4  
Old September 24th, 2003, 10:44 AM
doltmann's Avatar
doltmann doltmann is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Waco TX (The land of the lost)
Posts: 17 doltmann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to doltmann
Well, even so.. wouldnt it echo the variable on the DATA statement? therefore setting the DATA to ####, ####, ####, #### ??

Reply With Quote
  #5  
Old September 24th, 2003, 10:55 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
####, ####, ####, #### must be const value..

Reply With Quote
  #6  
Old December 2nd, 2003, 07:02 PM
William Ellery William Ellery is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 2 William Ellery User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to William Ellery
Cool My take on this

Your problem is this: the READ statement reads data from a DATA statement. You are storing all your data as a String. Then, when you store it as data, you will only be able to read the string name, not the contents. After that you are out of data.

As I see it, you want the user to type in a whole bunch of names and something about pieces. You then want the program to store all that information and be able to access it again, right? This is my version of your program, but simplified and hopefully it works. I am used to QB4.5, so it may not work for you. By the way, I got rid of all the GOSUBs, as they are superfluous and take more code.
[COLOR = blue]
CLS

Open “Data.Dat” for Output as #1
DO
INPUT "Name: ", nameInput$
INPUT "Pieces: ", piecesInput$
IF nameInput$ = “” Then Exit Do
Write #1, nameInput$, piecesInput$
LOOP
Close #1

Open “Data.dat” for Input as #1
DO UNTIL
Input #1, name$, pieces$
PRINT name$, pieces$
LOOP Until Eof(1)
Close #1

END
[/COLOR]
I hope this helps. What I did was create a file to write the information to and access all the data from there. As an added bonus, you can look at this data any time you want after you close the program. However, every time you run the program, it erases the file's contents. Have fun in QB.

Reply With Quote
  #7  
Old December 2nd, 2003, 07:26 PM
socomdude socomdude is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 251 socomdude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 21 sec
Reputation Power: 6
Send a message via AIM to socomdude
that is old....i forgot how to program that

Reply With Quote
  #8  
Old December 2nd, 2003, 07:31 PM
William Ellery William Ellery is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 2 William Ellery User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to William Ellery
You caught me

I admit it. I still program in QBasic. It's archaic, I know, but it's a challenge. I'm crossing over more and more to VB.NET, though.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > QBasic...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT