 |
|
 |
vbgen Level: Moderator
 Registered: 10-10-2002 Posts: 876
|
Re: Timer?
what i think you are asking:
create a timer that will run for ten seconds, then play a sound after the ten seconds are over, and not while the ten seconds are running.
if i got that right...
'place a timer control on your form
'set its interval to 10000
'note: 1000 intervals = 1 second
Private Sub Timer1_Timer()
Beep
'then, if you want to stop the timer
'from beeping again..
Timer1.Enabled = False
End Sub |
if you want to add a sound from a file, then
place a windows media player control on your form
access is through the components of the toolbox
right click on the toolbox then select components
search for windows media player control, then check it.
create an instance, then place this in the form's code instead:
Private Sub Form_Load()
MediaPlayer1.AutoStart = False
End Sub
Private Sub Timer1_Timer()
MediaPlayer1.FileName = "c:windowsmediathe microsoft sound.wav"
MediaPlayer1.Play
'then, if you want to stop the timer
'from beeping again..
Timer1.Enabled = False
End Sub |
hope it works for you.
____________________________
Been busy trying to take a second degree <--it's not working out...
|
|
23-02-2003 at 09:23 AM |
|
|
vbgen Level: Moderator
 Registered: 10-10-2002 Posts: 876
|
Re: TIMER QUESTION!!!
if it's by the way i think you mean, then change the code to:
Private Sub Form_Load()
MediaPlayer1.AutoStart = False
Dim CountDown As Integer
CountDown = Timer1.Interval
End Sub
Private Sub Timer1_Timer()
CountDown = CountDown - 1000
Label1.Caption = CountDown & "Seconds Left."
MediaPlayer1.FileName = "c:windowsmediathe microsoft sound.wav"
MediaPlayer1.Play
'then, if you want to stop the timer
'from repeating,
Timer1.Enabled = False
End Sub |
[Edited by vbgen on 25-02-2003 at 09:44 PM GMT]
____________________________
Been busy trying to take a second degree <--it's not working out...
|
|
25-02-2003 at 01:41 PM |
|
|
|
|
 |
 |