-
Object Array
I have a form with a lot of PictureBoxes. I created an array of these by name, but when I index the array I cant assign an image to the indexed item. In fact all the indexes appear to be nothing. Is there a way to create an array of controls and access them from the array?
-
Re: Object Array
Control array of them? Please be descriptive, and add some of your code, so we know what you've tried.
Code:
' Use CODE TAGS like this
-
Re: Object Array
Paul, if I do this :
Code:
Public Class Form1
Private PicBox(4) As PictureBox
Private i As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PicBox(i) = New PictureBox
PicBox(i).Image = Image.FromFile("C:\" & i.ToString & ".bmp")
PicBox(i).Visible = True
PicBox(i).BorderStyle = BorderStyle.FixedSingle
PicBox(i).Left = 20 * (i * 2)
Me.Controls.Add(PicBox(i))
i = i + 1
End Sub
End Class
It seems to work fine :)
Can you show us your code, and how you implemented it perhaps ¿