Go Premium for a chance to win a PS4. Enter to Win


Arrays Timer and Graphics

Posted on 2002-05-11
Medium Priority
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
  • 2

Accepted Solution

ammox2000 earned 400 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

886 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