QuestionHelpCountdown Timer with Sound

Posts 1–15 of 16 · Page 1 of 2
Countdown Timer with Sound
How would I make a countdown timer and once it reaches the time, it has like an alarm sound or whatever sound I get it too?

Basically an alarm clock, except you set it to ring in say like 5 minutes or whatever.
Help would be greatly appreciated!
Timer1: Label1.text = Timeofday
Timer1: If label1.text = "timehere" then console.beep
Quote Originally Posted by xBearGrylls View Post
Timer1: Label1.text = Timeofday
Timer1: If label1.text = "timehere" then console.beep
I'll give this a try, although it doesn't seem like that is quite enough code, nonetheless thank you.
Cool , I'd like to make one of these. My orchestra teacher uses something like this, I believe it's "Howler Timer" or something and once it reaches 0, instead of a beep, it howls :P.
Think about it like this.. and how to make your objectives

1st objective: Create an event where you enter a time
2nd objective: Create the timer
3rd objective: If this time reaches this time then.. alarm sound
Quote Originally Posted by DawgiiStylz View Post
Think about it like this.. and how to make your objectives

1st objective: Create an event where you enter a time
2nd objective: Create the timer
3rd objective: If this time reaches this time then.. alarm sound
So I see, I'm just not that experienced in VB to exactly do that :P. But I'll see what I can do, wonder if my teacher will use it if I make one . Thank you :3.
Quote Originally Posted by SomeAsianDude View Post
So I see, I'm just not that experienced in VB to exactly do that :P. But I'll see what I can do, wonder if my teacher will use it if I make one . Thank you :3.
Its not that hard if you think about it. Here's a quick way I would go about this.

Code:
'Need a label, textbox, and a timer.
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Label1.Text = Format(DateTime.Now, "hh:mm:ss")


        If Label1.Text = TextBox1.Text Then
            Console.Beep()
        End If
    End Sub
Quote Originally Posted by DawgiiStylz View Post

Its not that hard if you think about it. Here's a quick way I would go about this.

Code:
'Need a label, textbox, and a timer.
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Label1.Text = Format(DateTime.Now, "hh:mm:ss")


        If Label1.Text = TextBox1.Text Then
            Console.Beep()
        End If
    End Sub
Why thank you !
Quote Originally Posted by SomeAsianDude View Post
Why thank you !
If you need help with anything else.. I got chuuu haha
Quote Originally Posted by DawgiiStylz View Post

Its not that hard if you think about it. Here's a quick way I would go about this.

Code:
'Need a label, textbox, and a timer.
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Label1.Text = Format(DateTime.Now, "hh:mm:ss")


        If Label1.Text = TextBox1.Text Then
            Console.Beep()
        End If
    End Sub
Okay I tried this but the label wouldn't change because I see you already set what the label should say. Also wouldn't I need a button to start it or something? Sorry, I'm not a very or at all experienced VB coder. Or I didn't make anything complex or what I did make I had snippets of code already for me or I searched up.
Quote Originally Posted by SomeAsianDude View Post
Okay I tried this but the label wouldn't change because I see you already set what the label should say. Also wouldn't I need a button to start it or something? Sorry, I'm not a very or at all experienced VB coder. Or I didn't make anything complex or what I did make I had snippets of code already for me or I searched up.
Go to your timer properties and set the "Enabled" to True.
What that does it auto starts the timer when the form loads
Quote Originally Posted by DawgiiStylz View Post

Its not that hard if you think about it. Here's a quick way I would go about this.

Code:
'Need a label, textbox, and a timer.
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Label1.Text = Format(DateTime.Now, "hh:mm:ss")


        If Label1.Text = TextBox1.Text Then
            Console.Beep()
        End If
    End Sub
This is more count up then count down...

I'd recommend using a background thread and a numeric updown.

your background thread can be set up like such:
Code:
Sub DatSub()
    Dim Count as int64 = 0
    While Count < NumericUpDown1.Value
         Threading.Thread.Sleep(1000)
         Count += 1
         if countdown then
            label1.text = NumericUpDown1.Value - Coun
         End If
    End While
    if StandardBeep Then
        Console.Beep()
    else
        My.Computer.Audio.Play("c:\temp\temp.wav") ' This method must use a wav, not an mp3.
    end if
end sub
That must be on a background thread and the formLoad should contain "Control.CheckForIllegalCrossThreadCalls = False". As a note, most people say disabling the check for illegal cross thread calls is bad, but delegates are a bitch. So if you want to recode it using delegates, feel free.
Quote Originally Posted by LilGho$t View Post
This is more count up then count down...

I'd recommend using a background thread and a numeric updown.

your background thread can be set up like such:
Code:
Sub DatSub()
    Dim Count as int64 = 0
    While Count < NumericUpDown1.Value
         Threading.Thread.Sleep(1000)
         Count += 1
         if countdown then
            label1.text = NumericUpDown1.Value - Coun
         End If
    End While
    if StandardBeep Then
        Console.Beep()
    else
        My.Computer.Audio.Play("c:\temp\temp.wav") ' This method must use a wav, not an mp3.
    end if
end sub
That must be on a background thread and the formLoad should contain "Control.CheckForIllegalCrossThreadCalls = False". As a note, most people say disabling the check for illegal cross thread calls is bad, but delegates are a bitch. So if you want to recode it using delegates, feel free.
Oaaaah he said a countdown timer. I probably go at it similar to your example
Quote Originally Posted by LilGho$t View Post
This is more count up then count down...

I'd recommend using a background thread and a numeric updown.

your background thread can be set up like such:
Code:
Sub DatSub()
    Dim Count as int64 = 0
    While Count < NumericUpDown1.Value
         Threading.Thread.Sleep(1000)
         Count += 1
         if countdown then
            label1.text = NumericUpDown1.Value - Coun
         End If
    End While
    if StandardBeep Then
        Console.Beep()
    else
        My.Computer.Audio.Play("c:\temp\temp.wav") ' This method must use a wav, not an mp3.
    end if
end sub
That must be on a background thread and the formLoad should contain "Control.CheckForIllegalCrossThreadCalls = False". As a note, most people say disabling the check for illegal cross thread calls is bad, but delegates are a bitch. So if you want to recode it using delegates, feel free.
I'll give this a try, thank you C:!
Quote Originally Posted by DawgiiStylz View Post

Oaaaah he said a countdown timer. I probably go at it similar to your example
Thanks for helping anyways !
Posts 1–15 of 16 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us