Link to home
Start Free TrialLog in
Avatar of Jamie Fellrath
Jamie FellrathFlag for United States of America

asked on

Trying to search arrayList "fields" and return Index

Hi everyone,

I've got an ArrayList that has been populated with objects defined in our business logic, using data returned from a SQL Stored Procedure.  The app I'm working in is developed in VB.NET 2.0 (yes, I know. :) ).

I'm trying to figure out how to search through that ArrayList for a specific substring of characters in one "field" from the objects in the ArrayList, return the index of that item, and then remove it from the ArrayList.  

I was trying something like this:  

        For i As Integer = 0 To oAcc.FundList.Count - 1
            If oAcc.FundList.Item(i).OptionCode.ToString().Substring(0, 2) = "CD" Then
                oAcc.FundList.RemoveAt(i)
            End If
        Next

Open in new window

Where oAcc.FundList() is my ArrayList and OptionCode is one of the fields in the object contained in oAcc.FundList().

The problem I'm getting is that nothing is being returned, and I verified that there should be something returned based on the data from the Stored Procedure.  

Where am I going wrong?  

Changing the datatype of the Object returning the ArrayList is, unfortunately, not an option here.
ASKER CERTIFIED SOLUTION
Avatar of Ken Butters
Ken Butters
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jamie Fellrath

ASKER

Awesome!  Thank you so much, that did the trick exactly!  I think I was staring at this for too darned long!  :)