Support Forums

Full Version: [Question] Countdown 2
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know some here probably would say just edit your old post. But that's useless because people usually just think they already helped me. But anyway my new question is here..


1. Is there a way i could make my countdown beep once it reached 0?

2. How can i make it you can't do -1 (or any number) Because if they do that they go up instead of going down :/
Code:
Private Sub Button1_Click(ByVal sender As System.Object, _
            ByVal e As System.EventArgs) Handles Button1.Click
        Dim frequency As Integer = 10000
        Dim duration As Integer = 5000

        Console.Beep(frequency, duration)
    End Sub

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As  _
        System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        'allows only numbers
        'and backspace
        If (e.KeyChar < "0" OrElse e.KeyChar > "9") _
            AndAlso e.KeyChar <> ControlChars.Back Then
            e.Handled = True
        End If
    End Sub

you get the idea
Theres a much simpler way. What are you using to display ur countdown ?
Lets say your using a label.

Code:
If label1.text = "0" Then
            Console.Beep(1000, 1000)
        End If
Dunlop, where do i add that code?

But thanks both of you guys Big Grin I'll try it out.
Put it in timer1_tick, im uploading one i made just there now onto youtube , ill post it here in 2 min , if you want the code let me know.

Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
      If label1.text = "0" Then
            Console.Beep(1000, 1000)
        End If
      End If

Here it is

[yt]http://www.youtube.com/watch?v=hnNsO_NGVoQ[/yt]
Althought i put a .wav file in my project "Resources" and coded it like this:

Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Label1.Text = "0" Then
            My.Computer.Audio.Play(My.Resources.heart_monitor, AudioPlayMode.BackgroundLoop)
            Timer1.Stop()
        End If
    End Sub
All i need is how you add music :S, I know the rest Big Grin Tyvm dunlop you been very helpful. I'd rep if you knew how to and if i would been able to
np m8

Get a .WAV file

Goto vb, double click "My Project" , select "Resources" , simply drag and drop the .WAV file into the "Resources"

Now you can use this to play that file (heart_monitor , is my .WAV file name) , replace that with your file name:

Code:
My.Computer.Audio.Play(My.Resources.heart_monitor, AudioPlayMode.BackgroundLoop)