| Rick Rothstein [MVP - Visual Basic] 2006-01-23, 9:57 pm |
| > How would I go about creating a 2 dimensional array
> of text boxes so that each box can be referred to by
> a row, column reference?
You can't have a two-dimensional control array, but you can simulate one
from a one-dimensional control array. Number the Index values of your
TextBox control array consecutively starting at 0 and moving horizontally up
to the maximum column and then move down to the next row. For the code
procedures that follow, I am assuming the Row and Column values will be
counted from 0 upward. The only thing the routines need to know is the
ColumnCount (although you probably will need to know the RowCount also, for
error checking purposes).
If you know the Row and Column:
ControlArrayIndex = Row * ColumnCount + Column
If you know the control array index:
Row = ControlArrayIndex \ ColumnCount
Column = ControlArrayIndex Mod ColumnCount
Remember, ColumnCount is the number of columns, not the maximum column
index.
Rick
|