![]() |
Date and Time
I want to be able to put a continuing date and time text on an application.
I can use this fuction: Format(Now, "f"), which outputs: Monday, June 04, 2007 12:12PM ,but once the date and time is shown, it will stay the same forever... I guess It would need to work with a timer or something, but can somebody please give me some help on this? Thanks in advance! |
Just throw it in a timer_tick event. Set its enabled property to true, and have it update every second.
|
yeh as Booze said.. add a timer to you application. set its event to whatever the code is to update your clock.. and enable it to update every 100 (thats in millisecs)
|
Yeh 100 milliseconds should be OK for you! Are you OK with the exact syntax? What you wrote looked good.
|
I have not done anything in VB.NET for a while but does an Timer object not need to be started explicitly rather than simply enabled? - Im sure it does, so enabling an instance in your application will be a little disappointing.
|
1 Attachment(s)
Very simple example to show what i think you want. Make a form, with a label, and two buttons, IF you click the first button starts the timer ( <timername>.start() ), second button ( <timername.stop> ). The rest you should be able to get from the code below.
:
The attached is a all the files from my little test project, made in VS2005 SP1. |
Yep but make sure you drag it from the toolbox first!
|
| All times are GMT -5. The time now is 11:25 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC