I've poked around the internet and this forum and can't get a clear answer to this:
I'm trying to get an array of pictureBox(es) to appear on the form. Nothing I try seems to work, so.. any help would be appreciated. I va esomething like this:
Dim invaders(4) As PictureBox
invaders(0) = Me.picAlien1
invaders(1) = Me.picAlien2
invaders(2) = Me.picAlien3
invaders(3) = Me.picAlien4
Dim x As Integer
For x = 0 To invaders.Length - 1
invaders(x) = New PictureBox <<< === says it's needed, but seems to be counterproductive
invaders(x).Left = x * 40
invaders(x).Top = 40
invaders(x).Image = Image.FromFile("SIbottom0.gif")
Next
This isn't really what I want anyway, but better than nothing, which is what I got now.. Ideally, what I would like is a dynamic array of picture boxes that can be created at run time, so basically something like this:
Dim invaders(4) As PictureBox
Dim x As Integer
For x = 0 To invaders.Length - 1
invaders(x) = New PictureBox
invaders(x).Left = x * 40
invaders(x).Top = 40
invaders(x).Image = Image.FromFile("SIbottom0.gif")
Next
Any help would be greatly appreciated..
thanks...
I'm trying to get an array of pictureBox(es) to appear on the form. Nothing I try seems to work, so.. any help would be appreciated. I va esomething like this:
Dim invaders(4) As PictureBox
invaders(0) = Me.picAlien1
invaders(1) = Me.picAlien2
invaders(2) = Me.picAlien3
invaders(3) = Me.picAlien4
Dim x As Integer
For x = 0 To invaders.Length - 1
invaders(x) = New PictureBox <<< === says it's needed, but seems to be counterproductive
invaders(x).Left = x * 40
invaders(x).Top = 40
invaders(x).Image = Image.FromFile("SIbottom0.gif")
Next
This isn't really what I want anyway, but better than nothing, which is what I got now.. Ideally, what I would like is a dynamic array of picture boxes that can be created at run time, so basically something like this:
Dim invaders(4) As PictureBox
Dim x As Integer
For x = 0 To invaders.Length - 1
invaders(x) = New PictureBox
invaders(x).Left = x * 40
invaders(x).Top = 40
invaders(x).Image = Image.FromFile("SIbottom0.gif")
Next
Any help would be greatly appreciated..
thanks...