title: Dynamically add checkboxes to groupbox
body: <p>i am trying to dynamically add checkboxes to a groupd box based on the amount of rows in a datatable.  when looping through i get my first result but i am not able to get the next results to show...here is my code</p>
  
  <pre><code>Dim q As String
      Dim qt As DataTable
      Dim gbHeight As Integer = 40
      Dim checkHG As Integer = 5
      Dim checkHN As Integer = 5
  
  
      q = "Select * from loads where filenumber = " &amp; Shipments2.txtFileNumber.Text
      qt = GetSQL(q)
  
  
      For i = 0 To qt.Rows.Count - 1
          Dim items As New List(Of LoadDetails)
          Dim ld As New LoadDetails
  
          items = ld.GetListBySQL("select * from loadDetails where LoadNumber = " &amp; qt.Rows(i).Item("id"))
          For Each item As LoadDetails In items
              Dim checkgross = New CheckBox
              Dim checknet = New CheckBox
              gbHeight += 20
  
              'add checkbox control to form
              checkgross.Location = New Point(40, checkHG + 20)
              checkgross.Text = item.Description &amp; " (Gross)"
              checkgross.Size = New Size(250, 20)
              checkgross.Name = item.ProductCode.ToString &amp; "-gross"
  
  
              gbGross.Size = New Size(329, gbHeight)
              gbGross.Controls.Add(checkgross)
  
  
              rbPrintingNet.Location = New Point(rbPrintingNet.Location.X, rbPrintingNet.Location.Y + 40)
  
              checknet.Location = New Point(40, checkHN + 20)
              checknet.Text = item.Description &amp; " (Net)"
              checknet.Size = New Size(250, 20)
              checknet.Name = item.ProductCode.ToString &amp; "-net"
  
              gbNet.Location = New Point(44, rbPrintingNet.Location.Y + 25)
              gbNet.Size = New Size(329, gbHeight)
              gbNet.Controls.Add(checknet)
  
              Me.Size = New Size(Me.Size.Width, Me.Size.Height + 50)
  
  
          Next
      Next
  </code></pre>