Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

VB - Time

hi does anyone know the code to show the continous time instead of the time of when the form loads?thanks
0
student_help
Asked:
student_help
1 Solution
 
WarLordCommented:
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
 
IeuanJCommented:
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
 
M.E.PierceCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
IeuanJCommented:
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
 
WarLordCommented:
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
 
IeuanJCommented:
I dont think you read it wrong WarLord I think he changed it after getting the first answer he wanted (free questions?).
0
 
JacamarCommented:
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
 
CleanupPingCommented:
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
 
DanRollinsCommented:
Moderator, my recommended disposition is:

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

DanRollins -- EE database cleanup volunteer
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now