I have a custom control object called cc1.
I store cc1 like this Public cc1List As New List(Of cc1)
and add stuff to it, works like a charm.
Now i want to remove some item inside it, with a known index, so i create Dim cc1ListTemp As New List(Of cc1)
, loop through the whole index of cc1, and append all items excluding the removed index through this Code: cc1ListTemp.Add(cc1List(i))
but it keeps on throwing an OutOfRangeException, beginning with the first loop (i = 0) all the way up.
But i know for sure that cc1List(i)
where i = 0 to 5 is fully populated, and checked even in runtime before triggering the exception (i can fully access/edit/call cc1List(0)).
Do i need to append in a different way? If needed i can provide more code.
Edit0:
Dim cc1ListTemp As New List(Of cc1)
For i = 0 To CWBListMaxIndex
If Not i = IndexToRemove Then
cc1ListTemp.Add(cc1List(i))
End If
Next
cc1List = cc1ListTemp
Adding works fine, mixed add/append.
cc1List.Append(cc1TempObject)
cc1List.Add(cc1TempObject)
Edit1: reproduced it with Textboxes replacing cc1 inside a new project.