Cody Gray had it correct in his comment. I don't believe you can create a control array on the fly only in code in VB6. You have to place one instance of the control on the form and give it an Index
property value of zero. This creates a control array with only one element, at index zero. You can then modify your code to produce the desired result, like so:
Private Sub Form_Load()
Dim i As Integer
Dim j As Integer
For i = 0 To 14
For j = 0 To 14
Dim tileIdx As Integer
tileIdx = i * 15 + j
'If the tile index is zero, we already have that control,
'so there's no need to load new instance. Otherwise, use the
'Load method to create a new control in the array with the
'specified index.
If tileIdx > 0 Then
Load lblTile(tileIdx)
End If
With lblTile(tileIdx)
.Width = 1000
.Height = 1000
.Top = i * 1000
.Left = j * 1000
.Visible = True
.BackColor = Int(Rnd(1) * 255) + &H100 * Int(Rnd(1) * 255) + &H10000 * Int(Rnd(1) * 255)
End With
Next
Next
End Sub
As noted in the comment, you don't need to load another instance of the control at array index zero because you did that at design time. I also iterated my array starting from zero for slightly easier calculation of the indices.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…