I am using an arraylist to store a collection of structure objects.
Each structure object consists of strings.
I can store and read the member strings of each object stored in the arraylist, but I can't figure out how to update a member string.
This is what I'm doing now:
Private Sub cboQ1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboQ1.SelectedIndexChanged
Dim s As String
s = cboQ1.SelectedItem
Dim c As Contact
c = contactArray(arrayIndex)
c.Q1 = s
As I said, I can access any object in the contactArray arraylist and read it, but when I assign a new value to an object's member, it doesn't stick - the next time I read the object from the arraylist, the change has disappeared.
(FWIW: Both contactArray and arrayIndex are declared as public:
Dim contactArray As New ArrayList()
Dim arrayIndex As Integer = 0)
Is there a way to update an object's items or do I need to remove the object from the arraylist, make the changes, and then insert/add the updated object back to the arraylist?