haistenh

haistenh

  • NA
  • 1
  • 0

arrays

Mar 25 2004 6:51 PM
having trouble filling an array from a "," delimited text file. Need help on the syntax. This is what I have so far: If cdlOpen.ShowDialog() = DialogResult.OK Then Dim wrkLesson As New System.IO.StreamReader(cdlOpen.FileName) 'MessageBox.Show(wrkLesson.ReadToEnd) 'wrkLesson.Close() End If ' Create an instance of StreamReader to read from a file. Dim sr As StreamReader = New StreamReader(cdlOpen.FileName) Dim line As String ReDim quiz(12, 4) line = sr.Read() Do For row = 0 To 12 line = sr.ReadLine() For col = 0 To 4 quiz(row, col) = line Next col Next row elemCount = elemCount + 1 Loop Until line Is Nothing MessageBox.Show(quiz(0, 1) & quiz(1, 1)) sr.Close() I think "readline" is part of my problem because the MessageBox command at the end of this code displays an entire line instead of just one "","" delimited element. Any help much appreciated. Thanks