Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create an Array of Flex Grids 1

Status
Not open for further replies.

sttcharl

Programmer
Dec 5, 2002
29
US
I am wanting to create an array of 20 different flex grids
but I notice VB requires that you set items in the array the following way

Dim MSFlexESchedule(20) As MSFlexGrid
For i = 0 To 19
Set MSFlexESchedule(i) = MSFlexGrid1
Next

but this makes all the flex grids the same since then point to MSFlexGrid1. How do I make it so that all the Flex Grids are their own Flex Grids.

Thanks,
Steve
 
Hi,

I've never used 'flexgrids', but your understanding of arrays is incorrect.

You set i (subscript) to equal the flexgrid held within it.

So if you want to refer to flexgrid 20 you refer to it with:

MSFlexESchedule(19)

(as 19 is the 20th item in the array, 0 = first).

In your code, you are setting MSFlexGrid1 to every item in the 20 row of the array.

You are holding MSFlexGrid1 20 times! Why?

You HAVE told the code to step through each row and add the MSFlexGrid1 to each!

Do this.....

Set MSFlexESchedule(0) = MSFlexGrid1
Set MSFlexESchedule(1) = MSFlexGrid2
Set MSFlexESchedule(2) = MSFlexGrid3
Set MSFlexESchedule(3) = MSFlexGrid4
Set MSFlexESchedule(4) = MSFlexGrid5
Set MSFlexESchedule(5) = MSFlexGrid6
Set MSFlexESchedule(6) = MSFlexGrid7
...
Set MSFlexESchedule(19) = MSFlexGrid20

etc....

or to make it easier later on, do this....

Dim MSFlexESchedule(21) As MSFlexGrid

Set MSFlexESchedule(1) = MSFlexGrid1
Set MSFlexESchedule(2) = MSFlexGrid2
Set MSFlexESchedule(3) = MSFlexGrid3
Set MSFlexESchedule(4) = MSFlexGrid4
Set MSFlexESchedule(5) = MSFlexGrid5
Set MSFlexESchedule(6) = MSFlexGrid6
Set MSFlexESchedule(7) = MSFlexGrid7
...
Set MSFlexESchedule(20) = MSFlexGrid20
etc.

(And ignore MSFlexESchedule(0)).

Regards,

Darrylle








"Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top