Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collection behavior when adding a new item
Message
De
24/07/2006 04:15:11
 
 
À
22/07/2006 19:45:22
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01138855
Message ID:
01139070
Vues:
14
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"?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform