473,657 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Could anybody suggest a way to create a timer?

Hello.

Could anybody suggest a way to create a timer?
I want to timer to be displayed to the user, telling he or she how much time
has passed.

Thanks.

--
Xero

http://www.chezjeff.net
My personal web portal
Nov 21 '05 #1
8 2479
Jeff,

That is not a timer as we are used in dotNet, that is more a tickcounter

In my opinion is the most simple one
\\\
dim start as integer = environment.tic kcount
dim ended as integer = environment.tic kcount - start
///

This ticks are in milliseconds.

However you can as well use the timespan and than use the Now every time for
currenttime and date

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps,

Cor

"Xero" <jeff_@_chezjef f_._net(remove_ underscores_and _this)>
Hello.

Could anybody suggest a way to create a timer?
I want to timer to be displayed to the user, telling he or she how much
time
has passed.

Thanks.

--
Xero

http://www.chezjeff.net
My personal web portal

Nov 21 '05 #2
"Xero" <jeff_@_chezjef f_._net(remove_ underscores_and _this)> schrieb:
Could anybody suggest a way to create a timer?
I want to timer to be displayed to the user, telling he or she how much
time
has passed.


Take a look at 'System.Windows .Forms.Timer' and the 'DateTime' datatype.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Timer??? There is a timer control in the toolbox if you are talking about
winform.

chanmm

"Xero" <jeff_@_chezjef f_._net(remove_ underscores_and _this)> wrote in message
news:43******** *************** ***********@mic rosoft.com...
Hello.

Could anybody suggest a way to create a timer?
I want to timer to be displayed to the user, telling he or she how much
time
has passed.

Thanks.

--
Xero

http://www.chezjeff.net
My personal web portal

Nov 21 '05 #4
>> Could anybody suggest a way to create a timer?
I want to timer to be displayed to the user, telling he or she how much
time
has passed.


Take a look at 'System.Windows .Forms.Timer' .

????

Some new behaviour of that timer I don't know yet?

Cor
Nov 21 '05 #5
"Cor Ligthert" <no************ @planet.nl> schrieb:
Could anybody suggest a way to create a timer?
I want to timer to be displayed to the user, telling he or she how much
time
has passed.


Take a look at 'System.Windows .Forms.Timer' .

????

Some new behaviour of that timer I don't know yet?


A timer can be used to periodically raise an event (and update the display
with the time passed).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6
Herfried,

Could anybody suggest a way to create a timer?
I want to timer to be displayed to the user, telling he or she how much
time
has passed.

Take a look at 'System.Windows .Forms.Timer' .

????

Some new behaviour of that timer I don't know yet?


A timer can be used to periodically raise an event

Thank you for letting me know that, you could not know that, however I
already knew that.

In my opinion is a timer not to measure the passed time.

Or do they use in Austria alarm clocks to measure the time at sport events.

Cor
Nov 21 '05 #7
A "timer" in the programming world is different than a "timer" in the real
world.

In the real world, let's call anything that counts up from zero a stopwatch
or a clock, depending on the context.

To show the elapsed time on a form control, stpwatch style, you would need
two separate items: the current time and the starting time.

In the form class, declare:
dim StartTime as datetime

Load the starting time in the form's .Load handler like this:
StartTime=now

you then use a timer object (drop it in the form's desiner from the toolbar)
and in the timer's tick event, do something like this:

form.text=(now-starttime).tost ring

this will update the title bar of your form with the elapsed time since the
form was opened. I would suggest setting the timer's interval to 1000.

"Cor Ligthert" wrote:
Herfried,

> Could anybody suggest a way to create a timer?
> I want to timer to be displayed to the user, telling he or she how much
> time
> has passed.

Take a look at 'System.Windows .Forms.Timer' .

????

Some new behaviour of that timer I don't know yet?


A timer can be used to periodically raise an event

Thank you for letting me know that, you could not know that, however I
already knew that.

In my opinion is a timer not to measure the passed time.

Or do they use in Austria alarm clocks to measure the time at sport events.

Cor

Nov 21 '05 #8
Tom,

That was I telling to Herfried, why are you telling this to me.

When you answer a message in this newsgroup it is done by adding that too
the original question.

Not that it there is something wrong with it, however your answer is almost
the same as my original answer.

Therefore I am curious what you want to say to me.

Cor
"Tom Wilson" <To*******@disc ussions.microso ft.com>
A "timer" in the programming world is different than a "timer" in the real
world.

In the real world, let's call anything that counts up from zero a
stopwatch
or a clock, depending on the context.

To show the elapsed time on a form control, stpwatch style, you would need
two separate items: the current time and the starting time.

In the form class, declare:
dim StartTime as datetime

Load the starting time in the form's .Load handler like this:
StartTime=now

you then use a timer object (drop it in the form's desiner from the
toolbar)
and in the timer's tick event, do something like this:

form.text=(now-starttime).tost ring

this will update the title bar of your form with the elapsed time since
the
form was opened. I would suggest setting the timer's interval to 1000.

"Cor Ligthert" wrote:
Herfried,

>>>> Could anybody suggest a way to create a timer?
>>>> I want to timer to be displayed to the user, telling he or she how
>>>> much
>>>> time
>>>> has passed.
>>>
>>> Take a look at 'System.Windows .Forms.Timer' .
>>>
>> ????
>>
>> Some new behaviour of that timer I don't know yet?
>
> A timer can be used to periodically raise an event

Thank you for letting me know that, you could not know that, however I
already knew that.

In my opinion is a timer not to measure the passed time.

Or do they use in Austria alarm clocks to measure the time at sport
events.

Cor

Nov 21 '05 #9

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

Similar topics

2
1534
by: Chuck Rewood | last post by:
Hi, I am new in .NET and I'd like to build and application which control user's device. I've made a C# Windows application project that controls and run one of our POS device. Since I believe that .NET is making the way easier to web-enabled application, then I try to create application that control/run POS device on client's computer and send the
13
26611
by: Thom Little | last post by:
My first ASP.NET application on Visual Studio 2005 and .NET Framework 2.0 The application compiles and executes correctly on the development machine. I then publish it to an empty directory on the development machine. I then copy that directory to the remote server that contains numerous directories and some of them are using .NET Framework 1.1 (1.1 and 2.0 are both installed on the server). When I call the page I get the message ...
2
5698
by: Laphan | last post by:
AAAAARRRRGGGGHHHH!!! Everything appears to be great in doing a web-based editor using the execCommands apart from the fact that there is no method to insert a table. I've seen somebody suggest that you create the table using pure DOM, but I can't reference it to the relevant place in the iFrame that I'm using, ie if I want to insert a table between 2 pieces of text that have just been typed then how to get the table to go into there.
2
2390
by: Todd Jaspers | last post by:
Hey guys, I've written several NT services before using Delphi. When I did, I would typically use the timer component and have a particular procedure run every, say... 30 minutes. What would the code (in C#) look like in order to create a loop under the Service1 procedure that would run every 30 minutes? Right now, just for testing, I have it run initially in the service start, but after that, it doesn't run again. Any help is...
0
824
by: Alexnb | last post by:
I am wondering what is the best way to create a timer, like an alarm, once it reaches a time, it triggers an event. I have a way of doing this but it seems like it isn't good at all. If it helps at all I am using a Tkinter, but that probably doesn't mean much. The way I was doing it was using a while loop, and just saying while current time is not = to trigger time, do nothing, and when it is, do event. -- View this message in context:...
3
1632
by: Alexnb | last post by:
I am wondering what is the best way to create a timer, like an alarm, once it reaches a time, it triggers an event. I have a way of doing this but it seems like it isn't good at all. If it helps at all I am using a Tkinter, but that probably doesn't mean much. The way I was doing it was using a while loop, and just saying while current time is not = to trigger time, do nothing, and when it is, do event. -- View this message in context:...
3
2717
by: elaine | last post by:
I have a web appliacation, what i want to do is starting a timer when "Application_Start" event handler is called. The timer is running asyncronizely, let's say, every 24 hours, it will create a new thread to run a certain process, after the process is done, the thread will be killed. So far, i have no idea how to do it. Can i instantiate a singleton object in "Application_Start"? How to make a timer to be running asyncronizely?
4
3957
by: John Dann | last post by:
I need what I'd call (in .Net) a timer, ie I need to run a function eg every 2 seconds - it doesn't need to be millisec accurate but it would be nice if it wasn't eg every 4 seconds or something. Rather surprisingly, Core Python (Chun) doesn't seem to index 'timer' or 'scheduler', which leaves me wondering whether this is an aspect of Python that isn't perhaps widely used? Looking around on the net I can see references to a thread...
4
2324
by: =?Utf-8?B?R29yZnk=?= | last post by:
Hey everyone. This is only my first week with C#, but I use actionscript a lot in Flash, so I have a very basic understanding of programming, but bear with me... I am trying to create a "FadeClass" that I can use to fade windows in my programs. I am using Visual C# 2008 Express right now. This is my "Form1.cs" in it's current state: using System;
0
8827
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...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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
7333
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...
0
5632
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
4158
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...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1620
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.