By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,600 Members | 1,683 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,600 IT Pros & Developers. It's quick & easy.

sliding images through two command button

P: 3
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.
Oct 5 '07 #1
Share this Question
Share on Google+
3 Replies


QVeen72
Expert 100+
P: 1,445
Hi,

use LoadPicture function:

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

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

Regards
Veena
Oct 5 '07 #2

P: 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--

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.  
  3. For i = 0 To 3
  4.  
  5.   If i = 0 Then
  6.     Picture1 [i].Picture = LoadPicture("C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpeg")
  7.   End If
  8.   If i = 1 Then
  9.     Picture1 [i].Picture = LoadPicture("C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpeg")
  10.   End If
  11.   If i = 2 Then
  12.     Picture1 [i].Picture = LoadPicture("C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpeg")
  13.   End If
  14.   If i = 3 Then
  15.     Picture1 [i].Picture = LoadPicture("C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills.jpeg")
  16.   End If
  17. Next i
  18.  
  19. End Sub
Oct 7 '07 #3

Expert 5K+
P: 8,434
VB doesn't use [square brackets] for indexes in an array. It uses (parentheses).
Oct 7 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.