Collection & IndexOf()

Hi,

I have this code and I do not understand what is wrong with “$MyColl.indexOf($ToSearch;0)”

<code 4D>
Case of
: (Form event=On Load)
Form.lesfactures:=ds.Factures.query(“Statut = :1”;“4”).orderBy(“DateEmission desc”)
Form.codedecontrole:=ds.XData.query(“XNom = :1”;“Checksum”).orderBy(“XDate desc”)

	C_COLLECTION($MyColl)
	$MyColl:=New collection
	
	For each ($Entity;Form.lesfactures)
		$MyColl.push(New object("checksum";$Entity.Checksum;"correct";False))
	End for each 
	
	For each ($Entity;Form.codedecontrole)
		$ToSearch:=$Entity.XTexte
		$n:=$MyColl.indexOf($ToSearch;0)
		If ($n>=0)
			$MyColl[$n].correct:=True
		End if 
		
	End for each 
	
	Form.MyColl:=$MyColl

End case

</code 4D>

During execution, I got always $n=-1, and the variable $ToSearch contains the right information to look for. What am I doing wrong?

[]25419838;“Your comment here…”[/]