I figured out how to add a control to my form based on the number of items added to a listbox.
ListBox1.Items.Add(TextBox1.Text)
TextBox1.Text = ""
For i As Integer = 0 To ListBox1.Items.Count - 1
'adds picturebox for as many listbox items added
Dim MyPictureBox As New PictureBox()
MyPictureBox.Location = New Point(25, 25)
MyPictureBox.Size = New Size(15, 15)
MyPictureBox.SizeMode = PictureBoxSizeMode.StretchImage
Me.Controls.Add(MyPictureBox)
MyPictureBox.Image = My.Resources.PDF_Info
Next i
What I can’t seem to figure out is how to add a second control, but add it in another location on the form.
So the first entry would place the picturebox at 25, 25 and when I enter a second item, it’ll create another picturebox at 45, 45 and etc.
Can this be done?
1 Answer