Cant seem to load an array from a file

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

'Declare array to load file
Dim mstrCarinfo(9, 3) As String

'Declare streamreader
Private datvehiclelookup As StreamReader

Private Sub Loadarray()
' Load Array
Dim intCol As Integer
Dim intRow As Integer

Do Until datvehiclelookup.Peek = -1
For intRow = 0 To 9
For intCol = 0 To 3

mstrCarinfo(intRow, intCol) =
datvehiclelookup.ReadLine

Next intCol
Next intRow
Loop
End Sub
 
Mike said:
'Declare array to load file
Dim mstrCarinfo(9, 3) As String

'Declare streamreader
Private datvehiclelookup As StreamReader

Private Sub Loadarray()
' Load Array
Dim intCol As Integer
Dim intRow As Integer

Do Until datvehiclelookup.Peek = -1
For intRow = 0 To 9
For intCol = 0 To 3

mstrCarinfo(intRow, intCol) =
datvehiclelookup.ReadLine

Next intCol
Next intRow
Loop
End Sub

Do you get a compile error or a runtime exception? Which one? Do you create
a StreamReader somewhere? How is the array written to the file?
 
Back
Top