Dim intXCount As Integer = 1
'Row Center
Dim intYCount As Integer = 1
Dim intYCount As Integer = 1
'start the loop
For intx = 1 To intTotalNumberOfCells
Dim strCellText As String = "x:" & intXCount & "y:" &
intYCount
intYCount
'Add a new cell
ThisTableLayoutPanel.RowStyles.Add
(New RowStyle(SizeType.Percent, 1))
ThisTableLayoutPanel.ColumnStyles.Add
(New ColumnStyle(SizeType.Percent, 1))
(New ColumnStyle(SizeType.Percent, 1))
'Pet object from the array
Next
'declare a pet object from the array
'at the index of the loop counter - 1
Dim ThisPet As Pet = MyPets(intXCount - 1)
'instantiate a MyPanel object
'& pass through the required pet object
Dim ThisPanel As New MyPanel(ThisPet, strCellText)
'Add the MyPanel control to the
'TableLayoutPanel's control collection
'TableLayoutPanel's control collection
ThisTableLayoutPanel.Controls.Add(ThisPanel)
'reset the coloumn counter (intXCount) to 1 and
'increment the row counter (intYCount) by 1
If intXCount > intNumberOfColumnsRequired Then
intXCount = 1
intYCount += 1
End If