Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can I base a grid on an array?
Message
From
29/04/1999 09:56:24
 
 
To
28/04/1999 22:49:59
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00213274
Message ID:
00213433
Views:
28
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform