Troubleshooting Exceptions: System.IndexOutOfRangeException
An IndexOutOfRangeException exception is thrown when an attempt is made to access an element of an array or collection with an index that is outside the bounds of the array or less than zero.
- Make sure that the maximum index on a list is less than the list size
The maximum index on a list must be less than the list size. For more information, see Arrays in the Common Type System.
- Make sure the index is not a negative number.
This exception will be thrown if the index is less than zero.