creating pictureboxes on the fly

  • Thread starter Thread starter John Devlon
  • Start date Start date
J

John Devlon

Hi,

I'm trying to fill a form in visual basic .net with pictureboxes
Unfortunately, it doesn't work... the boxes don't show

Can anyone please help me ?


Dim x As Integer = 0
Dim myCollection As List(Of PictureBox) = New List(Of PictureBox)
Dim Location As Integer = 50

For x = 0 To 5
Dim myBox As PictureBox = New PictureBox
myBox.SetBounds(50, Location * x, 34, 34)
myBox.BackColor = Color.Black
myBox.BringToFront()
myCollection.Add(myBox)
myBox = Nothing
Next

Thanx,

John
 
John Devlon said:
Hi,

I'm trying to fill a form in visual basic .net with pictureboxes
Unfortunately, it doesn't work... the boxes don't show

Can anyone please help me ?


Dim x As Integer = 0
Dim myCollection As List(Of PictureBox) = New List(Of PictureBox)
Dim Location As Integer = 50

For x = 0 To 5
Dim myBox As PictureBox = New PictureBox
myBox.SetBounds(50, Location * x, 34, 34)
myBox.BackColor = Color.Black
myBox.BringToFront()
myCollection.Add(myBox)
myBox = Nothing
Next

Thanx,

Hi,

You need to add your box to the control collection of the form/panel/control
it is displayed upon.



Robin
 
Back
Top