I have a dynamically created a TableLayoutPanel to which I have added 12 rows and added some controls. I had no problem adding rows to the end of the TLP.
Now I need to insert a row into the TLP at row 2 so it shifts the existing controls down. My code doesn't work. It doesn't add a new row. It adds the label into the existing row and pushes the control that was in that cell to the next empty cell.
Checkrow = 2
Layout_SidePanel.RowCount += 1
Layout_SidePanel.RowStyles.Insert(CheckRow, New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40))
Layout_SidePanel.Refresh()
Dim lbl As New Label
lbl.Margin = New Padding(6, 6, 3, 3)
lbl.Text = " "
Layout_SidePanel.Controls.Add(lbl, 1, CheckRow)