title: How to make an array of PictureBoxes in Visual Basic
body: <p><strong>How do I make an array of PictureBoxes in Visual Basic?</strong></p>
  
  <p>I'm trying to make a row of PictureBoxes -that's all the same size, and same picture- to display across the form. How could I do this?</p>
  
  <p>I made the array using this: </p>
  
  <pre><code>Dim blk(10) As PictureBox
  </code></pre>
  
  <p>and the code to place the PictureBoxes is this:</p>
  
  <pre><code>'Create PictureBoxes
      blk(0) = blk_Green()
      blk(0).Image = imgl_blk.Images(0)
      blk(0).Visible = True
      blk(0).SetBounds(10, 10, blk_Green.Width, blk_Green.Height)
      For i = 1 To 10 Step 1
          blk(i) = blk_Green()
          blk(i).Image = imgl_blk.Images(0)
          blk(i).Visible = True
          blk(i).SetBounds(i * 10, 10, blk_Green.Width, blk_Green.Height)'I will change this according to what it needs to be
      Next
  </code></pre>
  
  <p><em>imgl_blk</em> is an ImageList, and <em>blk_Green</em> is a ImageBox I've already made on the form.</p>
  
  <p>When I run it, only one of the PictureBoxes will show up, instead of all 10 from the array.</p>
  
  <p>This is what i'm trying to get (Or something like this):
  <img src="https://i.stack.imgur.com/xlE2F.png" alt="What i&#39;m trying to get"></p>
  
  <p>This is what happens instead:
  <img src="https://i.stack.imgur.com/byGDv.png" alt="What Happens"></p>
  
  <p>How could I make this work? Thanks in advance!</p>