Arrays Timer and Graphics

Posted on 2002-05-11
Last Modified: 2012-05-04
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.Picture = LoadPicture(disp(i))
Next i

End Sub

Private Sub cmdStop_Click()
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.

Question by:sramkris
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

ammox2000 earned 100 total points
ID: 7004158
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))
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.


Author Comment

ID: 7004982
Thanks Amol for your solution

Expert Comment

ID: 7009469
Thanks for your appreciation.


Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question