tags:

views:

45

answers:

2
Public extreme_foods As New System.Collections.ArrayList()
Dim i As Integer
i = 1

For Each s In split2
    extreme_foods(i) = s
    i = i + 1
Next

anyone know why extreme_foods(i)=s is giving INDEX OUT OF RANGE??

+3  A: 

because there are no items in it. try extreme_foods.Add(s)

dotjoe
+1  A: 

If I understand your code, you're trying to add elements to the ArrayList. I think you'd want to use the Add() method. So something like:

For Each s In split2
    extreme_foods.Add(s)
Next

I'm assuming that split2 is a Collection you've created somewhere else in your code.

Dana