Arrays Timer and Graphics

Hi All,

I have a program where i am trying to display a slide show with 10 jpeg files. I have stored them in an array and i have 3 buttons Play pause and stop and also a slider on which to display them accdgly. If i click the play button the slide show should start..The slider should display accdg to the positon in the slider..I have the code written for playing the slide show and the timer interval is fixed at 10000 but the slide show just zips past from 1 to 10 in no time inspite of the timer set at 10000..

Here is the code

Option Explicit
Dim disp(9) As String
Dim path As String
Dim i As Integer

Private Sub cmdPause_Click()
Timer1.Interval = 0
End Sub

Private Sub cmdPlay_Click()

For i = 0 To UBound(disp)
Timer1.Enabled = True
Image1.Refresh
Image1.Picture = LoadPicture(disp(i))
Next i

End Sub

Private Sub cmdStop_Click()
End
End Sub

Private Sub Form_Load()
disp(0) = "C:/UOP/Pictures/pic10.jpg"
disp(1) = "C:/UOP/Pictures/pic2.jpg"
disp(2) = "C:/UOP/Pictures/pic3.jpg"
disp(3) = "C:/UOP/Pictures/pic4.jpg"
disp(4) = "C:/UOP/Pictures/pic5.jpg"
disp(5) = "C:/UOP/Pictures/pic6.jpg"
disp(6) = "C:/UOP/Pictures/pic7.jpg"
disp(7) = "C:/UOP/Pictures/pic8.jpg"
disp(8) = "C:/UOP/Pictures/pic9.jpg"
disp(9) = "C:/UOP/Pictures/pic1.jpg"
Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()

Timer1.Interval = 10000
End Sub

I am not sure what i did wrong for the slides to go past at past pace..

Any help would be greatly appreciated.

Thanks
Ram
LVL 1
sramkrisAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ammox2000Connect With a Mentor Commented:
just change the following two procedures:

-----------------------------------------------------------------

Private Sub cmdPlay_Click()

i = 0          'or you can place it in Load event
Timer1.Enabled = True
Timer1.Interval = 10000

End Sub

-----------------------------------------------------------------

Private Sub Timer1_Timer()
Image1.Picture = LoadPicture(disp(i))
Image1.Refresh
i=i+1
if i>9 then Timer1.Enabled = False
End Sub

-----------------------------------------------------------------

you were trying to change images in for loop, actually it should be done in

the timer procedure.thats what i have changed in above procedures.

Amol.
0
 
sramkrisAuthor Commented:
Thanks Amol for your solution
0
 
ammox2000Commented:
Thanks for your appreciation.

Amol.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.