-
I'm doing a project whereby when the 'next' command button is clicked, te picture in the picture box change to another picture. All the pictures are in a folder (c:\cars). And each picture is named like ; car1. bmp, car2.bmp, and so on. There are 6 pictures altogether. How do I do this? Please help. . . :(
-
If you know these files are named Car1 - Car6.bmp, you can use something like this:
Code:
Private Sub cmdNext_Click()
Static iPicture As Integer
iPicture = iPicture + 1
If iPicture = 7 Then iPicture = 1
picPreview.Picture = LoadPicture("C:\Cars\Car" & CStr(iPicture) & ".bmp")
End Sub
cmdNext is the Command Button, picPreview is the PictureBox which should contain the loaded picture...
If you don't know what files are in the directory, you'll have to get a directory listing first, using Dir() or the FileSystemObject...