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 10:43:39
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
29/04/1999 09:56:24
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:
00213458
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,
Are you sure this would work ? An array could hold much different types of data in indiviual elements. Say my [2,3] array look like this :
aDummy[1,1] = "Hello1"
aDummy[1,2] = "Hello2"
aDummy[1,3] = "Hello3"
aDummy[2,1] = .f.
aDummy[2,2] = 1
aDummy[2,3] = {1/1/1999}
or even an object ref.
Second it sounds like you're trying to set indiviual cell.controlsources. Does it really work.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform