im trying to make a sub that loads an array of pictureboxes in a box/grid layout. this is what i have come up with so far, any advice or known better ways?
where room is a picturebox
Private Sub DrawBlankLayout(ByVal XRooms As Byte, ByVal YRooms As Byte)
Dim X As Byte
Dim Y As Byte
Dim CurrentRoom As Byte
For Y = 0 To YRooms - 1
For X = 1 To XRooms
If CurrentRoom < XRooms Then
CurrentRoom = Y + X
Else
CurrentRoom = X + (Y * 10)
End If
Load Room(CurrentRoom)
With Room(CurrentRoom)
.Left = (X * 250) + .Left
If Y > 1 Then .Top = (Y * 250) + .Height
.Visible = True
End With
DoEvents
Next
Next
End Sub