Post: [VB.NET] Making a Countdown
12-10-2010, 09:08 PM #1
Default Avatar
Oneup
Guest
(adsbygoogle = window.adsbygoogle || []).push({}); Well this was something is something from a program I wrote years back. Basically the user would put in a number and the program would then convert it to seconds and then begin the count down.

So to get this started, either drag a timer control over to your form or create one through code(not going to be going over this one)

Let's take what the use put in the textbox and convert it to seconds
(This program was based on hours)

    

Private Sub btn_start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_start.Click
Dim time As String

time = txt_time.Text * 3600
txt_time.Text = time
timer1.enabled =true
End Sub

I coded things wierd years ago, so you could pretty much do this a better way, but I'm just coping and pasting what I had.




In the timer_tick proceedure we are going to do this:

     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

txt_time.Text = myTime - 1
myTime = txt_time.Text
If txt_time.Text= 0 Then
'Insert event here
Next
End If
End Sub
12-11-2010, 06:35 PM #2
u sure it works dude
12-12-2010, 02:27 PM #3
Default Avatar
Oneup
Guest
Originally posted by stingtothemax View Post
u sure it works dude


I just post none working code, also I don't really spoon feed , I give examples, so you'll have to do some work to get it to work with what you need it to do
12-17-2010, 03:16 PM #4
ANGER
Banned
hello , gunna try this late rSmile

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo