Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hellow guys,

Can anyone help me please.....
I'm going to create a Countdown timer program that i will set it to any hour or minute or seconds i want then there will be an message that appears that it had executed, then start again to whatever i have set to the timer...

Example:
I will set my timer to every 30 minutes, then a message will appear "HELLO TIME IS UP!", then will back or reset again to 30 minutes...then show again the message an so on....

Can you please help me....
Any help is greatly appreciated...
Thanks in advanced!
Posted

You have just to create a timer and then add an handler for its Elapsed event. The parameter to pass to the constructor is the interval of the timer (milliseconds).
VB
Dim Time As New System.Timers.Timer(5000)
AddHandler Time.Elapsed, AddressOf Timer_Elapsed
Time.Start()


In the Timer_Elapsed sub you put the code that must be executed every tick of the timer:

VB
Private Sub Timer_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
    MsgBox("Time is up!")
End Sub
 
Share this answer
 
Assuming the is a Windows app since you didn't specify. Create a Timer and set the interval to your value and handle the Tick event
 
Share this answer
 
Comments
jleonorlane 27-Nov-10 21:52pm    
can you give me on how to handle on the tick event if the timer
[no name] 27-Nov-10 21:58pm    
Would you like me to write the app for you?
jleonorlane 27-Nov-10 23:13pm    
..no, just a bit of code on the tick event on the timer
Have a look at the timer tutorial here[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900