Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Collection behavior when adding a new item
Message
From
24/07/2006 04:15:11
 
 
To
22/07/2006 19:45:22
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01138855
Message ID:
01139070
Views:
12
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"?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform