473,324 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Timing In C#

Hi There!

Run into a bit of a dilemma, I'm new to C# but I'm sure stacks of you will find this easy!

Its regarding the timer functions, I've tried and failed numerous times as they just don't seem to do what it is I need to do!

Here it goes:

On my form I have 3 Labels:
- Minutes (lbl_Minutes)
- Seconds (lbl_Seconds)
- Milliseconds (lbl_Milliseconds)

And beside each label I have seperate 00 Labels (which will start timing on an event). What I was trying to do was once the button was pushed it will kick off the milliseconds timer and once that did one full cycle (a second) then the seconds would increase++ accordingly

What I'm struggling with is trying to find current .NET classes that could help me do this, they all seem restricted to include year/month etc whereas I'm just looking to time an event!

Any help or advice would be greatly appreciated, ideally I would love to solve this myself but wouldn't mind some help with regards which classes could help me (DateTime?)

Thanks for reading this, Take care.

Kindest Regards,
Marty
Jun 26 '07 #1
1 1690
Shanaj
51
Hi There!

Run into a bit of a dilemma, I'm new to C# but I'm sure stacks of you will find this easy!

Its regarding the timer functions, I've tried and failed numerous times as they just don't seem to do what it is I need to do!

Here it goes:

On my form I have 3 Labels:
- Minutes (lbl_Minutes)
- Seconds (lbl_Seconds)
- Milliseconds (lbl_Milliseconds)

And beside each label I have seperate 00 Labels (which will start timing on an event). What I was trying to do was once the button was pushed it will kick off the milliseconds timer and once that did one full cycle (a second) then the seconds would increase++ accordingly

What I'm struggling with is trying to find current .NET classes that could help me do this, they all seem restricted to include year/month etc whereas I'm just looking to time an event!

Any help or advice would be greatly appreciated, ideally I would love to solve this myself but wouldn't mind some help with regards which classes could help me (DateTime?)

Thanks for reading this, Take care.

Kindest Regards,
Marty

Hello,

If u want to display only time one label is enough

try this

in timer write and make timer interval as 1000 and enable the timer

label1.text = DateTime.Now.ToShortTimeString();
Jun 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: jj | last post by:
I've got one database server that works fine when transferring large amounts of data, but a new one that has been setup seems to want to timeout or drop the connection after a period of time. I've...
10
by: Greg Stark | last post by:
This query is odd, it seems to be taking over a second according to my log_duration logs and according to psql's \timing numbers. However explain analyze says it's running in about a third of a...
7
by: jamie | last post by:
hey all, I am attempting to do motion control for a final project, but I have a concern.... For motion control, timing is everyting, the better it is, the better it works. Currently I am...
9
by: Amir Ghezelbash | last post by:
Hey every body i had a question i am in process of writing an application, where this application needs to check the database on hourly bases to see if they are any information that are needed...
1
by: Novice | last post by:
Hi all, I'm at my wit's end on trying to insert some timing code into the server side code that parses the hashed data contained in the hidden field being submitted to the server I've tried...
3
by: gregory_may | last post by:
I have an application where I am using a System Thread to capture the screen & Broadcast it to clients. Its "working", but the timing on the background thread gets wildly erratic at times. Some...
2
by: Steven D'Aprano | last post by:
The timeit module is ideal for measuring small code snippets; I want to measure large function objects. Because the timeit module takes the code snippet argument as a string, it is quite handy...
2
by: julie.siebel | last post by:
Google apparently ate my original post to this (grr) so this'll be a bit more vague than the initial post, but...*sigh*. Javascript is not my forte, and I apologize for the acky-ness of the...
3
by: CSharpner | last post by:
Is it just me or is everyone having problems with the MSDN site today? It keeps timing out. http://msdn.microsoft.com I've tried from: Oak Ridge, TN A proxy through our company net via...
0
by: Daniel Fetchinson | last post by:
On 4/15/08, Daniel Fetchinson <fetchinson@googlemail.comwrote: BTW, using the following ###################################################################### # CODE TO TEST BOTH...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.