-
Open "C:\PicView\Collections\FastLoadExp.txt" For Input As #1
j1 = 0
Do Until EOF(1) = True
Input #1, s1
ReDim Preserve pic(j1 + 1)
Set pic(j1) = New Picture1
pic(j1).Picture = LoadPicture(s1)
pic(j1).Visible = False
...
question:
why would the SET, NEW statements create an arror like
"user defined type not defined" ?
the pic() variable is a global that is of type PictureBox
-
If you create the Picturebox as a Control Array (Set the controls Index property to Zero) then you can add to it at runtime, i.e.[CODE]Private Sub Command1_Click()
Dim iFile As Integer
Dim sFile As String
iFile = FreeFile
Open "C:\PicView\Collections\FastLoadExp.txt" For Input #iFile
While Not EOF(iFile)
Input #iFile, sFile
Load Pictureboxes(Pictureboxes.Count)
With Pictureboxes(Pictureboxes.Count - 1)
.Visible = True
.Move .Width * .Count, 0
.Picture = LoadPicture(sFile)
End With
Wend
Close iFile
End Sub[CODE]