Hi chaps
I am trying to create a coundown timer in a form, it must count from 60 seconds to 0 and must be started using a button on the form. I also would like to add a reset button if posible.
I have looked in archives and lots of places on the web but as yet I have not found anything that I can get to work.
I am sure that if you can get me on the right track I can get there in the end.
This is part of a final year degree project and I am more of an engineer/designer than a coder so help would be gratefully recieved.

Ted :

Here's an example I wrote for you, I added comments since you said programming is not your major.

Dim timercount As Integer = 60 'The number of seconds 
    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
        Timer1.Interval = 1000 'The number of miliseconds in a second
        Timer1.Enabled = True 'Start the timer
    End Sub

    Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
        Timer1.Enabled = False 'Stop the timer
        timercount = 60 'Reset to 60 seconds
        lblOutput.Text = timercount.ToString() 'Reset the output display to 60
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        lblOutput.Text = timercount.ToString() 'show the countdown in the label
        If timercount = 0 Then 'Check to see if it has reached 0, if yes then stop timer and display done
            Timer1.Enabled = False
            lblOutput.Text = "Done"
        Else 'If timercount is higher then 0 then subtract one from it
            timercount -= 1

        End If
    End Sub

If you need more help go to www.5150creations.com and click on Contact.

I hope this helps!
Dan5150

Many Thanks Dan5150, I think I have it sorted thanks to your very kind efforts.
So far I have it all in the form but have yet to get it to display the counter. I will work on it though and let you know how I get on.

Thanks again

Ted

To add the Label control:
Friend WithEvents lblOutput As System.Windows.Forms.Label

place this line under the Dim timercount

That should let you see your output.
For a great free IDE for VB and C#.net look for SharpDeveloper on the internet.

Hi ...

I am trying to create a coundown timer in a form, it must count using a button on the form. I also would like to add a reset button if posible.
if reset button are click then the timer will start countdown again.

I have looked in archives and lots of places on the web but as yet I have not found anything that I can get to work.
I am sure that if you can get me on the right track I can get there in the end.

i have know nothing about vb.net or about programming, so help would be gratefully recieved

_::suhanna::_

thank you so much...

love u all...

hi suhana... are your problem is solved?

hi....
yes..!!!

thank you so much...

but now i got new problem...

would you help me?

how do i do, when i double click at item using list view then bring and display the items at textbox and option button at the another form??please help me...im in urgent...thank you so much..

would you help me?

how do i do, when i double click at item using list view then bring and display the items at textbox and option button at the another form??please help me...im in urgent...thank you so much..

would you help me?

how do i do, when i double click at item using list view then bring and display the items at textbox and option button at the another form??please help me...im in urgent...thank you so much..

is this windows application/ web?

i hav created 10 forms using c#.net and i start a timer in the first form. wat shud i do to made the timer to be visible in all the other 9 child forms??

if u declared it with code like that:
Private Timer timerxx = new Timer();
u must declare it as a public like that
public Timer timerxx = new Timer();

good day guys, please am finding it difficult to to do d countdown timer in ASP.net (vb) to display on a label control (HH:MM:SS). can anyone help out?
on web application.
my email is
davo2cool@gmail.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.