Results 1 to 2 of 2

Thread: Click 'Next' to view another Picture from C drive

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Location
    Singapore
    Posts
    4

    Unhappy

    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. . .

  2. #2
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    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...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width