|
-
July 6th, 2009, 06:18 PM
#1
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?
-
July 6th, 2009, 08:21 PM
#2
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
-
July 7th, 2009, 09:22 AM
#3
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 ¿
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|