Android Question I am strugling with a Map type

FrancoisPG

Member
Licensed User
Longtime User
I am busy with a Kakuro game and would like to use the Map type. In my Process_Globals i have declared the following:

Type SplitBlk (Index As Int, HorLen As Int, HorVal As Int, VerLen As Int, VerVal As Int)
Dim SplitBlock As Map, spBlk As SplitBlk

Then i have the following sub where I Put an index and spBlk of SplitBlk type in the map. My problem is that if I look at my Map at the end of the loop, I have all the index's I have added, but all the values in spBlk are the same. They are all equal to the values of the last spBlk added?

Sub CalcNumbers
ind = 0
Do While ind < modGenOplos.aSelle
If kKur(ind).Tipe = Tipe.Split Then
spBlk.Initialize
spBlk.Index = ind
CalcSplitRight(spBlk)
CalcSplitDown(spBlk)
SplitBlock.Put(ind,spBlk)
End If
ind = ind + 1
Loop
End Sub
 
Last edited:

FrancoisPG

Member
Licensed User
Longtime User
Thank you, the Dim just before the initialize has resolved it! Just for me to understand it, does this happen because there was only one instance of spBlk and at the end of the loop all the entries in the Map has actually pointed to this one instance?

Thank you again
Francois
 
Upvote 0
Top