Start New Discussion within our Software Development Community

For a school project I need to make a timer with a bell sound that sounds every 60 seconds in VB, I cannot work out how to make the bell sound on the 60th second, I am not getting any errors in the VB console, so I assume that I am just using the wrong code or it is in the wrong place, if anyone can offer any advice or point me in the direction of resources, I would be forever in their debt.

Public Class OSCETimerControl

    Dim t As Integer
    Dim s As Integer
    Dim a As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        t = 1
        a = 60
    End Sub
    Private Sub BellTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BellTimer.Tick
        NDBell.Text = (s)
        s = s + 1
        If NDBell Is "60" Then My.Computer.Audio.Play(My.Resources.bell, AudioPlayMode.Background)
    End Sub
    Private Sub Seconds_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Seconds.Tick
        DSeconds.Text = (t)
        t = t + 1
    End Sub

^Thats what I have got so far I have however tried placing the code to run the wav file in the main form sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        t = 1
        a = 60
        If NDBell = (a) Then My.Computer.Audio.Play(My.Resources.bell, AudioPlayMode.Background)

    End Sub

There are actually 3 text boxes (not yet coded the final one) one for minutes, one for seconds and the final one is for the bell sound which will not be visible.

Thanks in advance.

hello !
you can do like this

'enable timer by using this code
timer1.enable= true
'now give interval , 1000 = 1 sec you want to perform action after 60 sec so
timer1.interval=60000
'now code this on the timer tick event 
My.Computer.Audio.Play("ur sound file path")

hope this will solve you prob
Regards

This question has already been answered. Start a new discussion instead.