Dim MapString(41, 7) As String
Private Sub MapForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'mapfile to array
Dim StrSplit(), LineRead As String
Dim x, y As Integer
'open the file
Dim sreReader As StreamReader = New StreamReader("MapFile.txt")
'x and y must be to 0
x = 0
y = 0
Do
LineRead = sreReader.ReadLine
'Split the line into strSplit string
StrSplit = LineRead.Split(","c)
Do While y < 8
MapString(x, y) = StrSplit(y)
y += 1
Loop
x += 1
y = 0
'Loop until no line
Loop Until sreReader.Peek = -1
sreReader.Close()
I now keep getting "Index was outside the bounds of the array." when it reaches "MapString(x, y) = StrSplit(y)".
the text file looks like this:
t1,None,None,None,0,None,None,None
t2,None,None,None,0,None,None,None
t3,None,None,None,0,None,None,None
.......
t42,None,None,None,0,None,None,None
I just don't understand why this happens, can anyone help?