D Disco Member Licensed User Longtime User Jun 22, 2013 #1 I have the following code in a For loop: Code: Copy If aMarkerIDs.IndexOf(m.Get("id")) <> -1 Then aMarker.id = m.Get("id") ' plus other attributes beside ID mapMarkers.Add(aMarker) End If aMarker is a custom type which is then added to a list called mapMarkers. I'm guessing that aMarker is being added by reference because I end up with mapMarkers containing items all with the same value as the last aMarker that was added. How do I store each aMarker as separate instance? Is there a "New" keyword in B4A or something similar? Thanks!
I have the following code in a For loop: Code: Copy If aMarkerIDs.IndexOf(m.Get("id")) <> -1 Then aMarker.id = m.Get("id") ' plus other attributes beside ID mapMarkers.Add(aMarker) End If aMarker is a custom type which is then added to a list called mapMarkers. I'm guessing that aMarker is being added by reference because I end up with mapMarkers containing items all with the same value as the last aMarker that was added. How do I store each aMarker as separate instance? Is there a "New" keyword in B4A or something similar? Thanks!
D Disco Member Licensed User Longtime User Jun 22, 2013 #2 Gah, nevermind. I just had to Dim it again. :sign0161: Upvote 0