Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collection behavior when adding a new item
Message
De
24/07/2006 11:35:34
 
 
À
24/07/2006 04:15:11
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:
01139211
Vues:
16
>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
>
This is not a factor. If I do this, I end up in the same situation:
        Dim loCondition(2) As Object
        Dim loConditionResult(2) As Object

        loCondition(1) = "NoDBUsers"
        loCondition(2) = "NoEntity=" + oDashboard.nEntity.ToString
        oDropDownCondition.Add(loCondition)
        loCondition(1) = "NoDBUsers2"
        loCondition(2) = "NoEntity=" + oDashboard.nEntity.ToString
        oDropDownCondition.Add(loCondition)

        For Each loConditionResult In oDropDownCondition
            oApp.AddJavascriptMessage(loConditionResult(1))
        Next
The only way to have it ok is to have it like this:
        Dim loCondition(2) As Object

        loCondition(1) = "NoDBUsers"
        loCondition(2) = "NoEntity=" + oDashboard.nEntity.ToString
        oDropDownCondition.Add(loCondition)
        ReDim loCondition(2)
        loCondition(1) = "NoDBUsers2"
        loCondition(2) = "NoEntity=" + oDashboard.nEntity.ToString
        oDropDownCondition.Add(loCondition)

        For Each loCondition In oDropDownCondition
            oApp.AddJavascriptMessage(loCondition(1))
        Next
Note that I could have use loConditionResult for the For Each. It is not a factor in this situation. The only way to make it work is to ReDim loCondition everytime I need to add a new item. This is really weird.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform