Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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 Can't 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.

Posted

Instead of asking us if your code works, why don't you check for yourself by actually running the program? If it doesn't, follow these steps;

 

1) Try to figure out why and problem solve.

2) If you can't figure out why, try and determine where the problem might be in your code and then repeat step 1.

3) If you still can't get your code to work properly, post back here along with your theory on what a solution "might" be and why the solution hasn't worked.

Gamer extraordinaire. Programmer wannabe.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...