Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with IndexOutOfRange Exception
#2
All that really has to be looked at are these segments of code:

Code:
writer.Write(data(3).ToString + "=" + data(0).ToString)
Code:
Dim splitread() As String = reader.ReadToEnd.Split("=")
Code:
lbl_rank1.Text = "Rank: " + splitread(3).ToString

So what you are doing is writing two things into a text file, separated by an equals sign. Then you are reading that text file, and splitting up the elements by the equals sign. So you are splitting them up as
  • data(3).ToString
    data(0).ToString
Now, since this is an array, the first item (data(3)) will have an index of 0, and the second item (data(0)) will have an index of 1.

So with that in mind, you then try to get splitread(3).ToString. This throws an error because in the list, as we just saw, there are only items with an index of 0 and 1, and an item with the index of 3 does not exist.
My Blog | My Setup | My Videos | Have a wonderful day.


Messages In This Thread
Help with IndexOutOfRange Exception - by FtDLulz - 04-04-2012, 09:40 PM
Re: Help with IndexOutOfRange Exception - by brandonio21_phpbb3_import2 - 04-05-2012, 12:04 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)