Steve Putt
August 6th, 2002, 08:34 AM
I'm trying to fill my form with a 2-d array of pictureboxes. I need to refer to them in code like this - arrPbox(row, column). I'm stumped without an index property. How can insert them with a 2-d index-like reference in design, or if not then, create them at runtime? (Yes, I'm a rookie!)
I tried runtime with this, but the picture boxes don't even show up...
Dim arrPBox(9, 14) As PictureBox
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim bytRow, bytCol As Byte
For bytRow = 0 To 9
For bytCol = 0 To 14
arrPBox(bytRow, bytCol) = New System.Windows.Forms.PictureBox()
With arrPBox(bytRow, bytCol)
.BackColor = System.Drawing.Color.DarkGreen
.SetBounds((bytRow * 40), (bytCol * 40), 40, 40)
.TabStop = False
.Visible = True
.BringToFront()
End With
Next
Next
End Sub
Some of the With stuff is different things I did to try to see them.
Thanks a lot .... Steve
I tried runtime with this, but the picture boxes don't even show up...
Dim arrPBox(9, 14) As PictureBox
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim bytRow, bytCol As Byte
For bytRow = 0 To 9
For bytCol = 0 To 14
arrPBox(bytRow, bytCol) = New System.Windows.Forms.PictureBox()
With arrPBox(bytRow, bytCol)
.BackColor = System.Drawing.Color.DarkGreen
.SetBounds((bytRow * 40), (bytCol * 40), 40, 40)
.TabStop = False
.Visible = True
.BringToFront()
End With
Next
Next
End Sub
Some of the With stuff is different things I did to try to see them.
Thanks a lot .... Steve