?
Solved

VB - Time

Posted on 2003-02-28
10
Medium Priority
?
188 Views
Last Modified: 2011-04-14
hi does anyone know the code to show the continous time instead of the time of when the form loads?thanks
0
Comment
Question by:student_help
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 

Accepted Solution

by:
WarLord earned 80 total points
ID: 8040940
dim strdate as string
strdate = date()

if you want it in a textbox place this code


dim strdate as string

Private Sub Form_Load()
strdate = date
text1.text = strdate
End Sub

hope this is what you need

Greets Erik
0
 
LVL 2

Expert Comment

by:IeuanJ
ID: 8040941
to get the date

strDay = CStr(Day(Date))

to get the day (numerically)

strDay = CStr(Weekday(Date)))

to get teh day (name)

strDay = CStr(WeekdayName(Weekday(Date)))
0
 
LVL 1

Expert Comment

by:M.E.Pierce
ID: 8040943
Simplest way is to add a timer control to your project
set the interval to 1000 to update every second

call datetime.now() from the timer event.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:IeuanJ
ID: 8040962
did you change the text of this question or has EE screwed up ?  If you did change the text them pleae do not as you will have now asked and got answers fr two questions, not one.
0
 

Expert Comment

by:WarLord
ID: 8041044
sorry
i red it wrong

yes you can

place a timer on your form set the interval to 100 ( 10 updates a second )

double click on the timer then

and place a code like this

text1.text = time

thats all
0
 
LVL 2

Expert Comment

by:IeuanJ
ID: 8041070
I dont think you read it wrong WarLord I think he changed it after getting the first answer he wanted (free questions?).
0
 
LVL 2

Expert Comment

by:Jacamar
ID: 8042132
This will give you the current time, and will update every second if you set the interval to 1000 on the timer control.


Private Sub Timer1_Timer()
Text1.Text = Format(Now, "hh:mm:ss AM/PM")
End Sub
0
 

Expert Comment

by:CleanupPing
ID: 8900989
student_help:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9001624
Moderator, my recommended disposition is:

    Accept WarLord's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question