sliding images through two command button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gourab
    New Member
    • Sep 2007
    • 3

    sliding images through two command button

    How to write a code in vb to slide images through two command button named like previous and next.When next button will be pressed the next image will be shown in picture box.and the vice-versa for the previous button.
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    use LoadPicture function:

    Picture1.Pictur e = LoadPicture ("C:\Pict1.bmp" )

    Keep a Counter / FileListbox, and loop through all pictures..

    Regards
    Veena

    Comment

    • gourab
      New Member
      • Sep 2007
      • 3

      #3
      I have made a control array of the picture box and kept a counter of it and tried to loop through all the pictures..But it is not working.....Plz . help.
      I have tried it like this--

      [CODE=vb]Private Sub Command1_Click( )

      For i = 0 To 3

      If i = 0 Then
      Picture1 [i].Picture = LoadPicture("C: \Documents and Settings\All Users\Documents \My Pictures\Sample Pictures\Winter .jpeg")
      End If
      If i = 1 Then
      Picture1 [i].Picture = LoadPicture("C: \Documents and Settings\All Users\Documents \My Pictures\Sample Pictures\Water lilies.jpeg")
      End If
      If i = 2 Then
      Picture1 [i].Picture = LoadPicture("C: \Documents and Settings\All Users\Documents \My Pictures\Sample Pictures\Sunset .jpeg")
      End If
      If i = 3 Then
      Picture1 [i].Picture = LoadPicture("C: \Documents and Settings\All Users\Documents \My Pictures\Sample Pictures\Blue hills.jpeg")
      End If
      Next i

      End Sub[/CODE]
      Last edited by Killer42; Oct 7 '07, 11:05 AM.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        VB doesn't use [square brackets] for indexes in an array. It uses (parentheses).

        Comment

        Working...