title: vb.net dynamically create checkboxes
body: <p>I am trying to figure out how to go about creating dynamic checkboxes on my form when I do not know exactly how many boxes I will need.</p>
  
  <p>The problem is that I do not know how to DIM more than one object. This is my code for creating one checkbox</p>
  
  <pre><code>Dim checkBox As New CheckBox()
  
  Form1.Controls.Add(checkBox)
  checkBox.Location = New Point(10, 10)
  checkBox.Text = "testing"
  checkBox.Checked = True
  checkBox.Size = New Size(100, 20)
  </code></pre>
  
  <p>It works just fine but i am unable to add more than one checkBox without having to do this:</p>
  
  <pre><code>Dim checkBox As New CheckBox()
  Dim checkBox2 As New CheckBox()
  
  Form1.Controls.Add(checkBox)
  checkBox.Location = New Point(10, 10)
  checkBox.Text = "testing"
  checkBox.Checked = True
  checkBox.Size = New Size(100, 20)
  
  Form1.Controls.Add(checkBox2)
  checkBox2.Location = New Point(40, 10)
  checkBox2.Text = "testing2"
  checkBox2.Checked = True
  checkBox2.Size = New Size(100, 20)
  </code></pre>
  
  <p>etc...</p>
  
  <p>Is there a way to dim more than 1 checkbox instead of having to write multiple dim statements for each checkBoxe?</p>
  
  <p><B>
  Sorry maybe i should say this..</p>
  
  <p>I'm looking to do something like this:</p>
  
  <pre><code> dim checkBox() as CheckBox
  
   do until i = 50
      Form1.Controls.Add(checkBox(i))
      checkBox(i).Location = New Point(10, 10)
      checkBox(i).Text = "testing " &amp; i
      checkBox(i).Checked = True
      checkBox(i).Size = New Size(100, 20)
      i += 1
   loop
  </code></pre>
  
  <p></B></p>