• Welcome to Valhalla Legends Archive.
 

picture box array.

Started by Imperceptus, August 12, 2006, 04:33 PM

Previous topic - Next topic

Imperceptus

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
Quote from: Hazard on August 07, 2003, 03:15 PM
Highlight your entire code. Press the delete key. Start over again using Cuphead's CSB tutorial and work your way from their rather than raping code from downloaded sources meant purely for learning purposes. If this does not fix the problem, uninstall Visual Basic and get a new hobby. I suggest Cricket.