By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,671 Members | 1,278 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,671 IT Pros & Developers. It's quick & easy.

Clock in switchboard

P: 1
i have implemented a switchboard for navigation and inserted the date & time function, i wish to veiw the seconds changing on the screen, don't know how to set this feature, Thanks A
Mar 7 '08 #1
Share this Question
Share on Google+
2 Replies

P: 234
Are you asking if you can put a, for lack of better description, clock on your form? If so, create a label on your form and type clock in it. Then set your forms's OnTimer event to
Expand|Select|Wrap|Line Numbers
  1. me.label1.caption = Time()
  2. me.refresh
in the TimerInterval

Make sure in the OnClose event of your form stops the timer.
Expand|Select|Wrap|Line Numbers
  1. me.timerinterval = 0
Mar 7 '08 #2

Expert 2.5K+
P: 3,532
This sets the TimerInterval and immediately populates the textbox until the timer function cranks up:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.  Me.TimerInterval = 1000
  3.  Me.txtDateTime = Now
  4. End Sub
This populates the textbox every second:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2.  Me.txtDateTime = Now
  3. End Sub
You can lock the textbox if you like, but anyone messing with it will find that the correct date/time reappears every second anyway!

And the TimerInterval does not have to be set to zero on closing the form! It stops automatically when the form closes.

Welcome to TheScripts!

Linq ;0)>
Mar 7 '08 #3

Post your reply

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