|
-
Oct 8th, 2000, 04:40 PM
#1
Thread Starter
Hyperactive Member
I have 2 more questions:
1 Q:
How can I dispay the time that my Application has been running in a label... hours, minutes, seconds?
2 Q:
My Timer's Inerval is set to 15 seconds, how can I dislay a countdown of these 15 seconds in a label? (When the timer is going to set off the action?)
Thanks!
-Emo
-=VB6 Enterprise Edition=-
-=VC++6Enterprise Edition=-
«¤E³m°O²™¤»
-
Oct 8th, 2000, 04:58 PM
#2
A1:
Code:
Public Dt As Date
Public Hr As Date
Private Sub Form_Load()
Dt = Format(Now, "dd/mm/yy")
Hr = Format(Now, "hh/mm/ss")
End Sub
Private Sub Timer1.Timer()
lblDt = Dt - Format(Now, "dd/mm/yy")
lblTm = Hr - Format(Now, "hh/mm/ss")
End Sub
A2:
Hold on...
-
Oct 8th, 2000, 04:58 PM
#3
Frenzied Member
Put another Timer to the form (interval 1000) and put this code in it:
Code:
Dim x As Integer
Private Sub Form_Load()
x = 15
End Sub
Private Sub Timer1_Timer()
If x = 0 Then
x = 15
Label1.Caption = x
Else
x = x - 1
Label1.Caption = x
End If
And use the code from Escaflowne
for the time it's running
[Edited by Jop on 10-08-2000 at 06:01 PM]
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 8th, 2000, 04:59 PM
#4
Frenzied Member
Answer to your first question
Here's how to display the length of time your app has been running. Start a new project, drop a label and a timer onto the form, and paste the following code into your forms code module:
Code:
Option Explicit
Private StartTime As Date
Private Sub Form_Load()
Timer1.Interval = 60
StartTime = Now
End Sub
Private Sub Timer1_Timer()
Dim RunTime As Date
RunTime = Now - StartTime
Label1 = "Running time: " & Format(RunTime, "hh:mm:ss")
End Sub
[Edited by seaweed on 10-08-2000 at 06:07 PM]
-
Oct 8th, 2000, 05:36 PM
#5
Thread Starter
Hyperactive Member
Thanks!
Thanks a lot!
I got it to work!
Thanks!
-Emo
-=VB6 Enterprise Edition=-
-=VC++6Enterprise Edition=-
«¤E³m°O²™¤»
-
Oct 8th, 2000, 07:51 PM
#6
Sometimes, when your prog takes up a lot of resources, the timers may actually lose track, and then, you can never get them together again, so for looping processes, do:
<You need 1 timer with a interval of 1000>
Code:
Private TimLoop As Byte
Private Sub Timer1_Timer()
If TimLoop < 15 then TimLoop = TimLoop + 1
If TimLoop > 15 then
Timer1_Time15
TimLoop = 0
End If
End Sub
Private Sub Timer1_Time15()
'Your Code
End Sub
\
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|