stuck on VB program! help

piski

Senior member
Jan 21, 2002
312
0
0
I need to read in a file that looks like this

Name Weight
Name2 Weight2
etc...

I opened the file to read from. I set up a string variable to read the name and an integer variable to read the weight but when it reads the name it also reads the weight and stores both in the string character.I guess that I need to set up an array to read the data into I just dont know where to start. Could some one give me a little advice?

 

sandorski

No Lifer
Oct 10, 1999
70,238
5,809
126
Originally posted by: sandorski
I don't know all the workings of VB, but can offer some ideas(edit: I know SFA about VB actually ;) ):

1) Put the differing data on separate lines in your data file.

2) Setup your data in a certain format. What I mean is, use a colon(or any unique character) as a terminator. For eg "Jo Schmo: 145:". You would then setup your data retrieval code to Read until the unique character.

3) Doublecheck your current code for Syntax errors, you may have simply overlooked something or have failed to use a specific form of Read.

 

minendo

Elite Member
Aug 31, 2001
35,557
16
81
Originally posted by: sandorski
Originally posted by: sandorski
I don't know all the workings of VB, but can offer some ideas(edit: I know SFA about VB actually ;) ):

1) Put the differing data on separate lines in your data file.

2) Setup your data in a certain format. What I mean is, use a colon(or any unique character) as a terminator. For eg "Jo Schmo: 145:". You would then setup your data retrieval code to Read until the unique character.

3) Doublecheck your current code for Syntax errors, you may have simply overlooked something or have failed to use a specific form of Read.

csv would be much easier.