Results 1 to 4 of 4

Thread: [RESOLVED] Data to an array from TXT file

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Location
    NZ
    Posts
    178

    Resolved [RESOLVED] Data to an array from TXT file

    Hi folks. I am trying to sort a list of phone directories stored in a TXT via a bubblesort using a tempArray. The problem I have that the code breaks on the line that supposed to store the data in the array. This part of a bigger exercise but I need to list data alpha/numeric ascending.

    VB Code:
    1. Dim sr As StreamReader
    2.     Dim sw As StreamWriter
    3.     Dim temp() As String
    4.     Dim prompt As String
    5.     Dim counter, i, j As Integer
    6.     fn = "PHONELISTS.TXT" 'File with phone directories
    7.     sr = File.OpenText(f & fn)
    8.     counter = 0
    9.     Do While (sr.Peek <> -1)
    10.       counter += 1
    11.      :confused: [COLOR=Blue][B]temp(i) = sr.ReadLine [/B] [/COLOR]
    12.     Loop
    13.     sr.Close()
    14.     OpenDir(fn, counter)
    15.   End Sub
    Last edited by lionelnz; May 10th, 2006 at 04:58 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width