Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Re-dimensioning array is wiping contents of previous rows
Message
De
30/12/1999 10:55:23
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re-dimensioning array is wiping contents of previous rows
Divers
Thread ID:
00310407
Message ID:
00310407
Vues:
54
I've seen this problem before and exiting and restarting VFP has always made the problem go away in the past. Now, however I can't make it go away no matter what I do.

If I initialize an array and then enter a loop which dynamically redimensions the array, incrementing its row count and populating the new row with some data, each previous row should remain intact. Instead all of the previous rows contents are getting reset to .F..

[example]
dimension paArray( 1, 2)
store '' to paArray
for i = 1 to 3
dimension paArray( i, 2)
paArray( i, 1) = i
paArray( i, 2) = i**2
endfor
[end example]

The contents of the array should look like this:
paArray( 1, 1) = 1
paArray( 1, 2) = 1
paArray( 2, 1) = 2
paArray( 2, 2) = 4
paArray( 3, 1) = 3
paArray( 3, 2) = 9

What I'm getting though is:
paArray( 1, 1) = .F.
paArray( 1, 2) = .F.
paArray( 2, 1) = .F.
paArray( 2, 2) = .F.
paArray( 3, 1) = 3
paArray( 3, 2) = 9

Anybody have any ideas why and what can be done to prevent it?
"The most beautiful experience we can have is the mysterious ; it is the fundamental emotion which stands at the cradle of true art and true science." - Albert Einstein
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform