Solved Dynamically build a table

Posted on 2014-03-07
Last Modified: 2014-03-07

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
Question by:murbro
LVL 39

Accepted Solution

Pratima Pharande earned 500 total points
ID: 39911917
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.

Author Closing Comment

ID: 39911922
Thanks very much

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question