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:Murray Brown
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

by:Murray Brown
ID: 39911922
Thanks very much

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL ( and MongoDB (…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor ( Top Charts is a view in which you can set seve…

691 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