473,797 Members | 3,204 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Timing In C#

1 New Member
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_Millisecon ds)

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 1708
Shanaj
51 New Member
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_Millisecon ds)

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.To ShortTimeString ();
Jun 27 '07 #2

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

Similar topics

1
1589
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 tried to compare the variables and they seem to be the same. The versions of MySQL are slightly different with the good one being 3.23.41 and the one timing out being 3.23.58 Any ideas on what I can check for that would be different or help...
10
2172
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 second. What would cause this? Is it some kind of postgresql.conf configuration failure? I have the same query running fine on a different machine. QUERY PLAN...
7
3771
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 trying to use the timer function block to do a 10ms loop, but if I remember correctly.... that timing
9
1758
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 to be processed in the next upcoming hour so my application has to to connect to data base right on (for example) 5:00:00 then check all the jobs that are due on 5:00:00 5:15:00 5:30:00
1
1424
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 placing timing code in all of the following: Page_Load OnInit LoadViewState(object savedState) object SaveViewState()
3
1696
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 times, its right away, some times after 10 seconds. I have included the setup of the process and the outline of the Call Back Method. As posted, the callback method can be mildly erratic (only doing a debug.writeline) I am guessing up to an 80%...
2
3308
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 to use from the command line, but it is less convenient for timing large pieces of code or when working in the interactive interpreter. E.g. variations on this *don't* work: $ python Python 2.4.3 (#1, Jun 13 2006, 11:46:08)
2
1548
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 code. I'm working on a page for a travel company. There's way too much going on with it/on it, but I'm kind of stuck at this point - the client loves it, so I have to solve this problem.
3
1412
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 Frederick, VA A proxy through our company net via Houston, TX Remote controlling my own server from Houston, TX
0
1952
by: Daniel Fetchinson | last post by:
On 4/15/08, Daniel Fetchinson <fetchinson@googlemail.comwrote: BTW, using the following ###################################################################### # CODE TO TEST BOTH FUNCTIONS back = fill_matrix(generate_zero())
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9537
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
10469
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
10246
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...
0
9066
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
7560
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
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
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
3750
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.