Help am i doing this right

wrxdriven

Member
Joined
Sep 23, 2003
Messages
16
Here is what the final procedure needs to accomplish.
It Receives a string and returns an ArrayList. The string represents the location of the CD.txt file. here is an example of the text.txt file.

100;All That You Cant Leave Behind;U2;16.99;34;00005.jpg

The procedure will read the text file and create a CD object for each CD in the file. The file has one CD per line.

is this doing what i am asked?
I guess just copy and paste it.
It has a lot of chicken scratch in it but is does run.
If this is not right then what do it do? It needs to be a function i guess.

Sub Main()
Dim arrlst As New ArrayList()
Dim cddisk As CD
Dim filenum As Integer = FreeFile()
Dim filename As String = "C:\mydocuments\text.txt"
Dim disk As New CD()
Dim str As String()

Dim limiter As String = ";"
FileOpen(filenum, filename, OpenMode.Input)
Dim j As Integer
For j = 0 To 1
Dim arr As String()
Dim i As Integer
Do Until EOF(filenum)







Read one line of the line
Dim test As String = (LineInput(filenum))
arr = test.Split(limiter)
For i = 0 To arr.GetUpperBound(0)
Console.WriteLine(arr(i))
Next


Loop

Close File
FileClose(filenum)

Console.ReadLine()

Dim i As Integer
For i = 0 To 5
arr = str.Split(limiter)
Console.WriteLine(arr(i))
Next
disk.setid(arr(0))
disk.settitle(arr(1))


Console.WriteLine(disk.GetID)
Console.WriteLine(disk.GetTitle)
Dim disk As New CD(arr(0), arr(1))
arrlst.Add(disk)
Next
For j = 0 To arrlst.Count
cddisk = arrlst(j)
Console.WriteLine(cddisk.GetID())
Console.WriteLine(cddisk.GetTitle())

Next
Console.Read()
End Sub

thank you for your help.
 
Instead of asking us if your code works, why dont you check for yourself by actually running the program? If it doesnt, follow these steps;

1) Try to figure out why and problem solve.
2) If you cant figure out why, try and determine where the problem might be in your code and then repeat step 1.
3) If you still cant get your code to work properly, post back here along with your theory on what a solution "might" be and why the solution hasnt worked.
 
You probably want to look at the classes under System.IO (File, Stream, StreamReader for example) rather than using FileOpen and LineInput.
 
Back
Top