[RESOLVED] dynamic pictureboxes
hello, I create multiple dynamic pictureboxes and it are to many to add them all manually, is there a way I can e.g. use an integer which adds up every time a new picturebox is made. Then I want to add the same code to every picturebox. Now it creates the picturebox and moves it to the next spot and doesn't create a second. I am using this code if its helpfull:
Code I'm using Code:
Dim newimg As PictureBox = New PictureBox
If imgCounter < 5 Then
newimg.Height = 65
newimg.Width = 50
newimg.Name = "img" & imgCounter
newimg.Left = 'i want this to be 100 further every time
newimg.Top = wp1.Location.Y
newimg.Image = My.Resources.img
newimg.Visible = True
newimg.BackgroundImage = My.Resources.Road
newimg.SizeMode = PictureBoxSizeMode.StretchImage
Me.Controls.Add(newimg)
newimg.BringToFront()
imgCounter += 1
call TheCodeSub()
Else
imgSender.Stop() ' timer
imgCounter = 0
End If