?
Solved

timer?

Posted on 1998-08-03
7
Medium Priority
?
149 Views
Last Modified: 2010-05-03
i need to turn on a animation..i mean play an avi for some time like 5 secs
and turn it off after that....the avi will play only when the user clicks the start button
how do i do this in vb?
0
Comment
Question by:brohans
[X]
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
  • 3
  • 2
  • 2
7 Comments
 

Expert Comment

by:vinoopauls
ID: 1467619
Try this code:

   At design time set timer1.enabled=false
                              timer1.interval=5000

Private Sub Command1_Click()
    Timer1.Enabled = True
'  Play the AVI
End Sub

Private Sub Timer1_Timer()
'  Stop the AVI
Timer1.Enabled = False
End Sub

0
 

Author Comment

by:brohans
ID: 1467620
how do i play the animation before i show a form?
the animation must play for a while before the form is shown e.g.
as i click on the start button..the animation plays ..then the form shows

i used the code above and did not work..
the animation does not play before the form is shown..

0
 
LVL 18

Expert Comment

by:deighton
ID: 1467621
(declarations)

bEnd as boolean

Private Sub Form_Initialise()
         Timer1.Interval = 5000
         Timer1.Enabled = True
         bEnd = false      
     '  Play the AVI  here

          while not(bEnd)
          wend


     End Sub

     Private Sub Timer1_Timer()
     '  Stop the AVI here
        Timer1.Enabled = False
        bEnd = true
     End Sub
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:vinoopauls
ID: 1467622
But where is this start button??
That has to be on some form. put the timer on that form
0
 

Author Comment

by:brohans
ID: 1467623
i tried yr method
and it hang my pc probably
due to the
while loop that u suggest above...
can u correct it?
0
 

Author Comment

by:brohans
ID: 1467624
i tried yr method
and it hang my pc probably
due to the
while loop that u suggest above...
can u correct it?
0
 
LVL 18

Accepted Solution

by:
deighton earned 100 total points
ID: 1467625


     bEnd as boolean

     Private Sub Form_Initialise()
              Timer1.Interval = 5000
              Timer1.Enabled = True
              bEnd = false        
          '  Play the AVI  here

               while not(bEnd)
                     DoEvents               'Sorry forgot this vital bit
               wend


          End Sub

          Private Sub Timer1_Timer()
          '  Stop the AVI here
             Timer1.Enabled = False
             bEnd = true
          End Sub





0

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…
Suggested Courses

801 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