Solved

timer?

Posted on 1998-08-03
7
145 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
  • 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…
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…

786 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