I need to remove objects from an arraylist based upon certain user-specified conditions. I can successfully loop through the arraylist and remove items, but I am having a problem correctly referencing WHICH item in the arraylist I want removed. This is due my use of structures (it's an arraylist of structures). I am not sure how to reference the components of the structure within the arraylist directly (the conditions are checked against components of the structure). I'll post my code below. Any helpful suggestions are welcome.
VB.NET:
If chkName.CheckState = CheckState.Checked Then
i = 0
While i < tmpList.Count
If Not aData.aName = txtName.Text Then 'The problem lies here (aData isn't advanced from one to the next within the arraylist)
tmpList.RemoveAt(i)
Else
i += 1
End If
End While
End If