I’m attempting to dynamically add both columns and rows to a TableLayoutPanel. I have the following code so far:
l = new Label();
l.Text = "" + headers[headers.Count-1];
ColumnStyle cStyle = new ColumnStyle(SizeType.AutoSize);
theTable.ColumnStyles.Add(cStyle);
theTable.Controls.Add(l, colCount, 0);
colCount++;
Which is adds all the columns I need. I then try to switch to adding rows by using:
theTable.GrowStyle = TableLayoutPanelGrowStyle.AddRows;
But this doesn’t work. It instead takes the columns I added and makes them into rows. Is there a way to dynamically create Columns and then dynamically create rows?
Thanks
I couldn’t reproduce your problem:
There must be some code you aren’t showing that is causing the problem.