|
-
Oct 2nd, 2000, 05:47 AM
#1
Thread Starter
New Member
Could someone please tell me how to add a picture array? I can call the fuction, declare my variables(I think) but the picture doesn't show.
Help me!!
-
Oct 2nd, 2000, 06:01 AM
#2
_______
<?>
Dim myArr(4) '5 pictures
MyArr(0) = "C:\mypic1.jpg"
MyArr(1) = "C"\mypic2.gif"
etc.
Set Picture1.Picture = LoadPicture MyArr(0) ' load mypic1
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 2nd, 2000, 08:11 AM
#3
Fanatic Member
You can set an array of paths to pictures, or you can create a control array to a picturebox or an image.
For instance, add a picturebox to your form.
Select then copy the picturebox.
Click on your form again and paste the picturbox back on it.
The VBIDE will ask if you want to create a control array since there is a control named Picture1 already on the form.
Say yes. And there you have it, a control array.
You could also set the Index property of the Picturebox but I found copy & paste to be the quickest way to do it 
-
Oct 2nd, 2000, 08:32 AM
#4
_______
<?>
Code:
'or you can load a file's contents into an array
Option Explicit
Dim myArray()
Private Sub Form_Load()
'access all files within a folder
Dim stFile As String
Dim stDir As String
Dim i As Integer
stDir = "C:\myfolder\"
stFile = Dir$(stDir & "*.*")
Do While stFile <> ""
stFile = stDir & stFile
ReDim Preserve myArray(i)
myArray(i) = stFile
stFile = Dir
List1.AddItem myArray(i)
i = i + 1
Loop
End Sub
Private Sub Command1_Click()
Dim x As Integer
'tells you how many pictures were in the file
x UBound(myArray)
'to load the picture
'Set Picture1.Picture = LoadPicture(myArray(any # from zero to x))
Set Picture1.Picture = LoadPicture(myArray(7))
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 3rd, 2000, 06:59 AM
#5
Thread Starter
New Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|