<div dir="ltr"><div dir="ltr"><div>This is expected behaviour. Just like with arrays:</div><div></div><div>iArray[123] = 0 <br></div><div>iArray[123] = 1<br></div><div><br></div><div>Collection have "exist" method, which might be what you are looking for.</div><div><a href="http://gambaswiki.org/wiki/comp/gb/collection">http://gambaswiki.org/wiki/comp/gb/collection</a></div><div><br></div><div><br></div><div>Jussi<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 28, 2019 at 1:06 PM Denis Crowther <<a href="mailto:denisc@exemail.com.au">denisc@exemail.com.au</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Guys,<br>
<br>
If I add to a collection and the Key already exists the value is simply <br>
overwritten. No error is raised.<br>
<br>
Is this this the expected behaviour or a bug that will be fixed at some <br>
point?<br>
<br>
Regards<br>
Denis<br>
<br>
'----------------------------<br>
Dim cc As New Collection<br>
<br>
   cc.Add("test1", "MainKey")<br>
   Debug cc["MainKey"]<br>
<br>
   cc.Add("test2", "MainKey")<br>
   Debug cc["MainKey"]<br>
<br>
OUTPUT:<br>
Form1.Button1_Click.68: test1<br>
Form1.Button1_Click.70: test2<br>
'----------------------------<br>
-- <br>
Regards<br>
Denis<br>
<br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
</blockquote></div>