473,659 Members | 2,685 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

countdown timer

Hi everyone....

I'm trying to make something work...

When I launch a new form, the application has to quit after a few seconds...

I searched the net for some hours and I can't find any usefull code ...
I noticed there are several timers in .net...
Which one do I use ?

Thanx

John
Nov 21 '05 #1
2 1880
Hi,

If you're using Windows Forms, use a System.Windows. Forms.Timer. Put the
timer on your form and attach to the Timer.Tick event. When the event
fires, call Application.Qui t().

You can use System.Threadin g.Timer if you want, but this uses Windows
resources. The System.Timers.T imer class is more for server-based timers
that need better accuracy and ability to move between threads.

Regards,
-Adam.

John Devlon wrote:
Hi everyone....

I'm trying to make something work...

When I launch a new form, the application has to quit after a few seconds...

I searched the net for some hours and I can't find any usefull code ...
I noticed there are several timers in .net...
Which one do I use ?

Thanx

John

Nov 21 '05 #2
Thx, John.

"John Devlon" <jo********@hot mail.com> wrote in message
news:us******** *************@p hobos.telenet-ops.be...

Thanx Adam, It works great....

Below the code for other people who need it ...
Private Sub quit_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Timer.Start()
End Sub
Private Sub Timer1_Tick(ByV al sender As System.Object, ByVal e As
System.EventArg s) Handles Timer.Tick
Application.Exi t()
End Sub
John


"Adam Goossens" <ad***********@ gmail.com> schreef in bericht
news:uN******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

If you're using Windows Forms, use a System.Windows. Forms.Timer. Put the
timer on your form and attach to the Timer.Tick event. When the event
fires, call Application.Qui t().

You can use System.Threadin g.Timer if you want, but this uses Windows
resources. The System.Timers.T imer class is more for server-based timers
that need better accuracy and ability to move between threads.

Regards,
-Adam.

John Devlon wrote:
Hi everyone....

I'm trying to make something work...

When I launch a new form, the application has to quit after a few
seconds...

I searched the net for some hours and I can't find any usefull code ...
I noticed there are several timers in .net...
Which one do I use ?

Thanx

John


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2679
by: Bonnett | last post by:
I have been creating a generic countdown timer (source code below), counting the seconds, minutes, hours and days till an event, but I have having trouble with it finding out how many hours are left. When i get it to display a complete countdown (days hours mins seconds left) it is one hour short when counting dates that fall in the following time brackets: 2004,2,29 -> 2004,9,31 2005,2,28 -> 2005,9,30 2006,2,27 -> 2006,9,29 etc..
4
4380
by: Christine | last post by:
I've implemented a countdown timer for a tutorial web page that should give the user 45 minutes to complete the test, only to find that the timer is slowly 'losing' time. On average, it actually takes an extra 35 seconds, but has taken an extra 2.5 minutes in some cases. Any ideas what might be the cause? And more importantly - the fix? Code snippet below... Thanks, Christine
8
3747
by: Michael | last post by:
I have this script that works the way I want except for one thing... Once it hits zero it starts to count up and looks like this: -1:0-1:0-1:0-18 with the last number counting up. Can anyone help me find a way to stop it at zero? Thank you, Mike
1
29559
by: Will | last post by:
I have form showing instructions and logging actions and I would like the form to show a count down timer for a certain period of time. E.g. 30 secs, going down to 0 and then displaying the action. I want the user to be able to see the seconds counting down. Can anyone help me? thanks
3
4374
by: JimJam | last post by:
Hello Peeps I have created a program in VB.NET 2003 that counts down from 7.5 hours to zero from 08:00. I have a button that starts a new countdown from 1 hour to zero whilst the first one is couting down from 7.5 hours. How do I pause that time that is counting down from 1 hour & behind a new button restart it without losing one second? I would also like the time to count down from 37 hours, but will pause after
1
2163
by: Dirk Hagemann | last post by:
Hi! I'd like to implement a countdown timer on a webite. It should show the months, days, hours, minutes and seconds until a given date and time. So far it's not really difficult, but this website will be used from different time zones, what will make a difference of 10 hours, if I use the time-information from the client. The event will take place at one fixed moment which is worldwide the same. Does anyone know a way to solve this...
9
2322
by: Yet Another One | last post by:
Sorry if this has been answered before, but I simply cannot find the solution on my own. I am looking to do a countdown in my application. Basically, I need to count down from 5:59 (5 minutes, 59 seconds) and then perform a task. Performing the task is easy enough, but the countdown is just slipping past me. Anyone have any idea how I can best achieve this?
9
3852
by: MC | last post by:
I would like to display a timer in the corner of the page that shows the user how many minutes:seconds till the session times out. Are there any good examples out there? Google has again failed me ;) MC
5
2535
mageswar005
by: mageswar005 | last post by:
hi, I need a javascript countdown timer to my website, I have already the countdown timer but its have some problem. Note: 1) If i choose the tools/internet option in my browser means , at that time countdown cannot be stop. 2) If i refresh the page means the countdown should comes from begining time. this is for Browser session time out countdown timer. Regards,
0
8330
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8523
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6178
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.