Wednesday 6 June 2012

Dynamic Table creation


           
 Create table dynamically :
 
         Table tbl = new Table();              
                for (int i = 0; i < 5; i++)
                {
                    TableRow tRow = new TableRow();
                    tbl.Rows.Add(tRow);
                    for (int j = 1; j <= 5; j++)
                    {

                        TableCell tCell = new TableCell();
                        tCell.BorderColor = System.Drawing.Color.DarkGray;
                        tCell.BorderWidth = 1;
                        tCell.Width = 30;
                        tCell.Height = 20;
                        tRow.Cells.Add(tCell);
                    }
                }
                form1.Controls.Add(tbl);

No comments:

Post a Comment