Well, there's three ways you can do this (at least).
Firstly, create them programmatically, rather than placing them on the layout with drag and drop from the C2 editor, call System.CreateObject in a for loop, then you can use loopIndex to store them in a 2D array.
Secondly, you could give each an instance variable which is their index in the array (you could use the numbers in the text if these are containers with a sprite and text object in them) and use foreach to copy those values to an array
Thirdly, if you know they are going to be top left to bottom right ordered, you can use for each (ordered) with an expression something like button.X + button.Y * 10000 which will order them for you in that order, as long as your layout is less than 10000 high