F FrankBerra Active Member Licensed User Longtime User Oct 11, 2015 #1 Hi coders I have 2 lists "List1" and "List2" and i am trying to copy the content of the second to one and then i clear the second one. The code is: B4X: List1 = List2 List2.initialize The problem is that after the initialization the List1 is emptied too! Why?! A temporary workaround is: B4X: For z = 0 To List2.Size-1 List1.Add(List2.Get(z)) Next
Hi coders I have 2 lists "List1" and "List2" and i am trying to copy the content of the second to one and then i clear the second one. The code is: B4X: List1 = List2 List2.initialize The problem is that after the initialization the List1 is emptied too! Why?! A temporary workaround is: B4X: For z = 0 To List2.Size-1 List1.Add(List2.Get(z)) Next
Erel B4X founder Staff member Licensed User Longtime User Oct 11, 2015 #2 Always use Dim when you want to create a new object: B4X: List1 = List2 Dim list2 As List list2.Initialize Upvote 0
Always use Dim when you want to create a new object: B4X: List1 = List2 Dim list2 As List list2.Initialize