Help with arrays and sequential files

Joined
Oct 28, 2006
Messages
19
Programming Experience
Beginner
Hi, I'm currently doing an assignment for a class in VB.NET and I need some help. We have been asked to create a fairly simple event management program which stores the information entered into sequential files. We must then read the sequential file and run a series of queries such as guests who have RSVP'd and those who have made donations. I am unsure as to how to retrieve this sort of information from the file using VB.NET code. My array is set out as follows

"first name" "last name" "address" "phone number" "rsvp" "donation amount"


The program is designed to store 500 records. I am using Visual Studio 2003. Any help would be greatly appreciated as i have no idea how to search for the data or to return all of it to the program.
 
[speech] Sounds like your off to the right start, gather the information and learn from it rather than just seeking the direct answer. We're more than will to help you learn :) [/speech]

That being said, check out this for how to read: Reading from a Textfile

And this, for how to write: Writing to a Textfile

Read up on those two and then let us know any farther questions (new thread if different topic, here again if still about the files ;-))
 
Hey, thanks for the reply. I already know how to read and write the files its more how to search and display the results that im having trouble with. I tried to do a bit of code for returning results of those who rsvp'd. I stored it into a multidimensional array or at least tried but im not sure what the best way to display it would be. Heres my code

Dim i As Integer
Dim test() As String
Dim RSVP(,) As String
Dim sr As IO.StreamReader
If IO.File.Exists("NEWRECORD.TXT") Then
sr = IO.File.OpenText("NEWRECORD.TXT")
Dim strA As String
Do While sr.Peek <> -1
strA = sr.ReadLine
test = strA.Split(","c)
If test.GetValue(4) = "yes" Then
RSVP(i, 0) = test(0)
RSVP(i, 1) = test(1)
RSVP(i, 2) = test(2)
RSVP(i, 3) = test(3)
RSVP(i, 4) = test(4)
RSVP(i, 5) = test(5)
RSVP(i, 6) = test(6)
RSVP(i, 7) = test(7)
RSVP(i, 8) = test(8)
RSVP(i, 9) = test(9)
i += 1
End If
Loop
sr.Close()
End If
 
Back
Top