Hello,
just wondering, is there a way i can make a clock where it will conitnue to display the time up-to-date, meaning you will see the time and it will keep continuing to keep track of time progressivly so you can see it live? is that possible, i want to do something fun like you see the clock on the program, and if no mousemove, then after 10 seconds of clocktime passes without mousemove, close program, almost like those annoying websites when the session has timed out :) let me know if that is possible, i am sure but is it datetime class or what?
Thanks
clock count down timer
Started by Siten0308, Jul 07 2009 02:11 PM
13 replies to this topic
#1
Posted 07 July 2009 - 02:11 PM
|
|
|
#2
Posted 08 July 2009 - 12:14 AM
Absolutely there is a way.
#3
Posted 08 July 2009 - 04:38 AM
You can add a timer with the interval 1000 and in its tickhandle you can add something like this:
label.Text = Now;
#4
Posted 08 July 2009 - 08:06 AM
umm... i hate to burst that idea but the label1.Text = Now; does not work, sure thats not going to work, i mean the now is not going to work, i tried it and still does not work, you probably mean datetime.now, which does work i know that already, but how can i continue to keep counting or keep current time (continue seeing it keep live time) if that makes any sense, i will take a look at the interval 1000 thing.
If someone can help to solve the question thanks
If someone can help to solve the question thanks
#5
Posted 08 July 2009 - 10:05 AM
I'm on vaccation now so I can't test anything, but to make it update you make so the text will change to the current time each time the timer ticks. Didn't that work?
#6
Posted 08 July 2009 - 10:18 AM
how do you do that "change the text so it changes with the datetime.now"? is it a property or something?
#7
Posted 08 July 2009 - 10:23 AM
Didn't you said it worked?
#8
Posted 08 July 2009 - 10:34 AM
ok i think we are both getting confused here, let me explain, label1.Text = datetime.now is YES showing date and time correct, however, you dont see it update itself live, meaning you see the seconds counting etc. which is what i want, then i can therefore use interval to say after 1000 (miliseconds) shutdown program, later on i am going to use mouse event mousemove to if user does not do mouse move on form1 then interval 1000 miliseconds then close out program completely... cool huh but i would like to show the time though live and counting, its not working, the only thing is the program starts, you see the date and time however the time stays of where it first launched the program thats it. i hope this explains everything.
Thank you
Thank you
#9
Posted 08 July 2009 - 10:52 AM
So you add a Timer that has some code like this. Then what?
label1.Text = DateTime.Now.ToString();
proudly presenting my personal website and game website: F1Simulation. a thrilling Managed DirectX racing game... also my Ask Me
look at my tutorials about cropping images and Mono: bundling Mono with programs and lambda expressions
look at my tutorials about cropping images and Mono: bundling Mono with programs and lambda expressions
#10
Posted 08 July 2009 - 10:54 AM
that's since you only use label1.Text = datetime.now when the program starts, you need the program to use label1.Text = datetime.now once a second and that's what you have the timer for.
#11
Posted 09 July 2009 - 07:17 AM
Hello and thank you Arek,
Yup that worked, but the difference is with Arek's he used the Timer class and then it named it automatically to timer when when you drop it on the form, you then just assign the timer to label1. BUT MAKE SURE YOU ENABLE IT!!! lol by default it does not get enabled so therefore it keeps you scratching your head wondering why its still not working, other than that, after dropping the timer, double clicking on timer1, putting the code that Arek said, AND ENABLING IT in the properties box, it now works, you see the time live. awesome thanks Arek.
Yup that worked, but the difference is with Arek's he used the Timer class and then it named it automatically to timer when when you drop it on the form, you then just assign the timer to label1. BUT MAKE SURE YOU ENABLE IT!!! lol by default it does not get enabled so therefore it keeps you scratching your head wondering why its still not working, other than that, after dropping the timer, double clicking on timer1, putting the code that Arek said, AND ENABLING IT in the properties box, it now works, you see the time live. awesome thanks Arek.
#12
Posted 09 July 2009 - 08:00 AM
Just what I tried to tell you. Glad It worked for you. :D


Sign In
Create Account


Back to top









