Excellent :-)
Solution above works...
Rest of my code...
Adding a row and setting rowstyle...
CustomButton is a buttoncontrol in a collection of buttons...
foreach (CustomButton b in buttons)
{
b.Dock = DockStyle.Top;
AddRow(b);
}
}
private void AddRow(CustomButton b)
{
int rowIndex = AddTableRow();
tableLayoutPanel.Controls.Add(b, 0, rowIndex);
}
private int AddTableRow()
{
int index = tableLayoutPanel.RowCount++;
RowStyle style = new RowStyle(SizeType.AutoSize);
tableLayoutPanel.RowStyles.Add(style);
return index;
}