title: TableLayoutPanel rows & columns at runtime
body: <p>im trying to build a usercontrol which contains a tablelayoutpanel. in this panel i need to dynamically add 3 columns with each having different a width and 5 rows which all shell have the same height (20% of the tablelayoutpanel's height).</p>
  
  <p>column1 should have an absolute width of 20,
  column2 depending a width on its content (a textbox with .dock = fill)
  column3 a width of 30.</p>
  
  <p>my code:</p>
  
  <pre><code>Private Sub BuildGUI()
      If Rows &gt; 0 Then
  
          tlp.Controls.Clear()
          tlp.ColumnStyles.Clear()
          tlp.RowStyles.Clear()
  
  
          If Style = Styles.Adding Then
              tlp.ColumnStyles.Add(New ColumnStyle(SizeType.Absolute, 30))
              tlp.ColumnStyles.Add(New ColumnStyle(SizeType.Autosize))
              tlp.ColumnStyles.Add(New ColumnStyle(SizeType.Absolute, 20))
              tlp.ColumnCount = 3
  
              tlp.RowStyles.Add(New RowStyle(SizeType.AutoSize, 20%))
              tlp.RowStyles.Add(New RowStyle(SizeType.AutoSize, 20%))
              tlp.RowStyles.Add(New RowStyle(SizeType.AutoSize, 20%))
              tlp.RowStyles.Add(New RowStyle(SizeType.AutoSize, 20%))
              tlp.RowStyles.Add(New RowStyle(SizeType.AutoSize, 20%))
              tlp.RowCount = Rows
  
              For i = 0 To Rows - 1
                  Dim L As New Label
                  Dim T As New TextBox
                  Dim C As New CheckBox
  
                  With L
                      .BackColor = Color.Aqua
                      '.Dock = DockStyle.Fill
                      .Visible = True
                      .BorderStyle = Windows.Forms.BorderStyle.FixedSingle
                      .Font = New Font("Microsoft Sans Serif", 11, FontStyle.Bold)
                  End With
                  tlp.Controls.Add(L, 0, i)
  
                  With T
                      .BackColor = Color.Beige
                      .Visible = True
                      .Multiline = True
                      .ScrollBars = ScrollBars.Vertical
                      .Dock = DockStyle.Fill
                  End With
                  tlp.Controls.Add(T, 1, i)
  
                  With C
                      .Visible = True
                      .BackColor = Color.Brown
                  End With
                  tlp.Controls.Add(C, 2, i)
  
              Next
          Else
  
          End If
  
      End If
  </code></pre>
  
  <p>End Sub</p>
  
  <p>Styles &amp; Rows are properties of the Usercontrol.</p>
  
  <p>but the result is never as i want it to be. any ideas?</p>