Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified: Dynamically build a table


What code would I use to dynamically add a table to a panel
Then add a certain number of rows and columns to that table
Murray Brown
Murray Brown
1 Solution
Pratima PharandeCommented:
try this

Dim rowCnt As Integer
        ' Current row count
        Dim rowCtr As Integer
        ' Total number of cells (columns).
        Dim cellCtr As Integer
        ' Current cell counter.
        Dim cellCnt As Integer
        Dim Table1 As New Table
        rowCnt = 2
        cellCnt = 3
        Table1.BorderWidth = 1
        Table1.BorderColor = Drawing.Color.Black
        Table1.BorderStyle = BorderStyle.Solid
        Table1.GridLines = GridLines.Both

        For rowCtr = 1 To rowCnt
            Dim tRow As New TableRow()
            For cellCtr = 1 To cellCnt
                Dim tCell As New TableCell()
                tCell.Text = "Row " & rowCtr & ", Cell " & cellCtr
                ' Add new TableCell object to row.
            ' Add new row to table.
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now