468,301 Members | 1,468 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,301 developers. It's quick & easy.

How can i add time to my form, in VB language?

10
How can i add 'time' only (not date and time) to my form, in Visual basic Language.

i want to display current time at runtime, i have a label box called 'LabelTime' and i want the 'time' to be shown in this labelBox as it's text,

could you please advice?
Oct 29 '06 #1
4 2277
albertw
267 100+
How can i add 'time' only (not date and time) to my form, in Visual basic Language.

i want to display current time at runtime, i have a label box called 'LabelTime' and i want the 'time' to be shown in this labelBox as it's text,

could you please advice?
hi

suggest you put a timer on your form
set the timer-interval to 1000 (1 second) and enable it.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Timer1_Timer()
  2. LabelTime.Caption = Format(Time, "hh:mm:ss")
  3. End Sub
  4.  
Oct 29 '06 #2
Faez
10
Thank you!
Oct 29 '06 #3
is there a way to get that so it doesnt show up in millitary time.

instead of 18:45:30 like 6:45:30
Oct 30 '06 #4
Killer42
8,434 Expert 8TB
is there a way to get that so it doesnt show up in millitary time.

instead of 18:45:30 like 6:45:30
Look up the Format function in the online help - it explains how to set pretty much any format you want. If possible, use the Named Date/Time Formats (listed under See Also). That way it will pick up the user's Windows settings.

Incidentally, 24hr time is a good thing, once you get used to it. Removes a lot of ambiguity and confusion.
Oct 30 '06 #5

Post your reply

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

Similar topics

2 posts views Thread by androtech | last post: by
9 posts views Thread by ME | last post: by
4 posts views Thread by James Bond 007 | last post: by
7 posts views Thread by webmaster | last post: by
6 posts views Thread by D | last post: by
9 posts views Thread by Gregc. | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.