Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > time


Reply
 
Thread Tools Display Modes
  #1  
Old 12-08-2004, 12:34 AM
paperback paperback is offline
Newcomer
 
Join Date: Dec 2004
Posts: 9
Default time


i am attempting to put a current time on my program, but it is set to where you must click on it...

what component should i use for real-time

here is my code

Me.lblTime.Caption = "" & _
Format(Now, "hh:mm:ss am/pm")
Reply With Quote
  #2  
Old 12-08-2004, 12:52 AM
Gruff's Avatar
Gruff Gruff is offline
Bald Mountain Survivor

Super Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA
Posts: 5,876
Default

Put your code inside the timer event of a timer control. Set its interval to 1000. (1 sec)

~T
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
  #3  
Old 12-08-2004, 01:13 AM
paperback paperback is offline
Newcomer
 
Join Date: Dec 2004
Posts: 9
Default

ok i did that

now i have it as


Me.Timer1.Caption = "" & _
Format(Now, "hh:mm:ss am/pm")


but the 'Caption' is a problem??
Reply With Quote
  #4  
Old 12-08-2004, 02:03 AM
Verphix Verphix is offline
Restricted
 
Join Date: Nov 2004
Posts: 444
Default

You don't do it as so.
You have to insert the timer on your form, set it's interval property to 1000, double click it, and then insert your code :

Me.lblTime.Caption = "" & _
Format(Now, "hh:mm:ss am/pm")

So if your timer is timer1, it goes like this (you don't need the qoutes):
Code:
Private Sub Timer1_Timer() Me.lblTime.Caption = Format(Now, "hh:mm:ss am/pm") End Sub

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->