Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can I base a grid on an array?
Message
De
29/04/1999 09:56:24
 
 
À
28/04/1999 22:49:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00213274
Message ID:
00213433
Vues:
27
You CAN base a grid on an array....sort of.

Say you have any array myarray[4,3] that has four rows and three columns and you want to display the values in your grid. Place the following code in the load of your form:

create cursor dummy (du_rec i)

if alen(myarray,1) > 0
for lncnt = 1 to alen(myarray,1)
insert into dummy (lncnt)
endfor
else
insert into dummy (1)
endif

For the grid, set the RecordSourceType to alias and the RecordSource to dummy (or whatever you call the cursor).

Set the individual column controlsources like this:

MyGrid.Column1.ControlSource = "myarray[dummy.du_rec,1]"
MyGrid.Column2.ControlSource = "myarray[dummy.du_rec,2]"
MyGrid.Column3.ControlSource = "myarray[dummy.du_rec,3]"

Of course you can set all the grid properties interactively in the form or class designer so all you'll need to code is the load event which populates the cursor with the dummy records. Now you have a grid which reads from an array!

Hope this helps,


-JT
Jeff Trockman, MCP
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform