Hi,
The loCondition in the ForEach is not the same as the loCondition object..
In the second case oDropDownCondition holds two references to the same object. Using :
For Each loX In oDropDownCondition
oApp.AddJavascriptMessage(loX(1))
Next
may make what's happening clearer.
Regards,
Viv
>I am trying to understand something in regards to adding a new item in a collection. I have this code:
>
>
> Dim loCondition(2) As Object
>
> loCondition(1) = "NoDBUsers"
> loCondition(2) = "Something"
> oDropDownCondition.Add(loCondition)
>
> For Each loCondition In oDropDownCondition
> oApp.AddJavascriptMessage(loCondition(1))
> Next
>
> loCondition(1) = "NoDBUsers2"
> loCondition(2) = "Something"
> oDropDownCondition.Add(loCondition)
>
> For Each loCondition In oDropDownCondition
> oApp.AddJavascriptMessage(loCondition(1))
> Next
>
>
>On the first For Each, I have a message "NoDBUsers", which is normal because I only have one item inserted in the collection. But, on the second For Each, I have two messages, which is normal because I added an additional item in the collection, but both messages are "NoDBUsers2". I just cannot understand this behavior. Can someone explain me why I do not obtain "NoDBUsers" followed by "NoDBUsers2"?