Chilton Posted October 9, 2014 Share Posted October 9, 2014 I am attempting to build a table based on the following parameters: I have up to 10 appetizers to listThere can be any number from 5 to 10The user is setting the sort order (display order) of each item (so I am searching for next sort order, and pushing food listing to arrays titled Food01 - Food10determine last sort order to list in left column (leftLimit)I need to balance the listings across the two columns so that column 1 contains the first 1/2 of the food listings (+1 in cases of odd # of listings) and column 2 contains the second half of the food listings Once the contents of the arrays are set, I want to use a for loop to call the contents based on following: for (next = 1; next <= 10; next++) { [indent]if (food01[0] != "") //the "01" should equal next (from loop above) {[indent]myTable.AddRows(1); counter ++; //add table tags and set cell contents: //cell[0] = foodNEXT[0] //cell[1] = foodNEXT + leftLimit[0][/indent] } [/indent]}I am unable to figure out how to iterate the Array name so that I can call the right array at the right time Thanks! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted October 9, 2014 Share Posted October 9, 2014 Can you show the rest of the code where you're setting up the arrays? It's hard to just figure out one part of it looking through a keyhole. Anyway, I think you want to create an array of arrays, aka a two-dimensional array, so that you can access each array like Food[0] or Food, and then access elements in each array like Food[0][0] or Food[j]. A table is basically a two-dimensional array like this already, so really you're just using one 2D Array object to represent the data in a 2D table. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.