title: programmably create picturebox inside panel
body: <p>Hey all i have created a panel that i want to place a lot of pictureboxes inside of. I will be pulling pictures from the "my pictures" folder. I am wanting to have 3 pictureboxes per row.</p>
  
  <p>My current code is this:</p>
  
  <pre><code>Dim newPictureBox As New PictureBox
  
  newPictureBox.Image = Image.FromFile("C:\Users\Public\Pictures\Sample Pictures\Lighthouse.jpg")
  newPictureBox.Visible = True
  newPictureBox.Top = 0 'needed calulation here for each picturebox
  newPictureBox.Left = 0 'needed calulation here for each picturebox
  newPictureBox.Width = 536
  newPictureBox.Height = 338
  newPictureBox.BackgroundImageLayout = ImageLayout.Stretch
  Panel1.Controls.Add(newPictureBox)
  </code></pre>
  
  <p>That does just fine for the first picturebox inside the panel but i will be looping an unknown number of pictures that need pictureboxes to go with it. I know the next picturebox should have a <em>Left</em> value of 545 but i am unsure of how to calcualte that out? Then the <em>top</em> calculations for the second row, third row, etc...</p>
  
  <p>What would the process be for getting the correct <em>Top, Left</em> coordinates for each picturebox so that it only has 3 pictureboxes in each row?</p>