Solved

timer?

Posted on 1998-08-03
7
147 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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 50 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

Technology Partners: 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!

Question has a verified solution.

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

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…
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.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

732 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