Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Question] Countdown 2
#1
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 :/
Learning Visaul Basic Express Edition ^^
Reply
#2
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
~ Digital-Punk
Reply
#3
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
Reply
#4
Dunlop, where do i add that code?

But thanks both of you guys Big Grin I'll try it out.
Learning Visaul Basic Express Edition ^^
Reply
#5
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
Reply
#6
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
Learning Visaul Basic Express Edition ^^
Reply
#7
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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Question]CountDown p1g 0wnz 7 1,462 12-29-2009, 09:39 AM
Last Post: Digital-Punk

Forum Jump:


Users browsing this thread: 1 Guest(s)