Monday, July 26, 2010

27/7/2010 MyPets Array

        
       Dim MyPets(8) As Pet

        MyPets(0) = New Dog("Robbie", 2)
        MyPets(1) = New Dog("Benny", 4)
        MyPets(2) = New Dog("Pippy", 3)
        MyPets(3) = New Dog("Timmy", 5)
        MyPets(4) = New Cat("Princess", 4)
        MyPets(5) = New Cat("Prince", 6)
        MyPets(6) = New Cat("Anna", 10)
        MyPets(7) = New Cat("Crumpet", 13)
        MyPets(8) = New Cat("Muffin", 12)

        Dim intNumberOfRowsRequired As Integer = 3
        Dim intNumberOfColumnsRequired As Integer = 3
        Dim intTotalNumberOfCells As Integer 
        = intNumberOfRowsRequired
      
        'Instantiate an object of the TableLayoutPanel class.
         Dim ThisTableLayoutPanel As New Windows.Forms.TableLayoutPanel

        'set some of its properties
        'set the cell border style

        ThisTableLayoutPanel.CellBorderStyle 
        = ThisTableLayoutPanel.CellBorderStyle

        'set the number of columns

        'set the number of rows

        ThisTableLayoutPanel.RowCount = intNumberOfRowsRequired

        'set the position on the form and the dimensions of
        'the TabelLayoutPanel object

        ThisTableLayoutPanel.SetBounds(0, 0, Me.Width, Me.Height)

         'set how the object will dock to the form

        ThisTableLayoutPanel.Dock = DockStyle.Fill

No comments:

Post a Comment