|
-
February 29th, 2000, 07:12 PM
#1
Time
I am trying to make a program where, when you put 'start' and when you push that button, it records the time, then when you push 'stop' it records the time, and displays the time in a label, thnx
-
February 29th, 2000, 08:31 PM
#2
Re: Time
That was a bit confusing....Do you want to make a timer?
1) Make 2 command buttons, 1 label
Dim St as Boolean
private Sub Command1_Click()
Do Until St = true
Label1.Caption = Label1.Caption + 1
Pause 1
Loop
End Sub
private Sub Command2_Click()
St = true
End Sub
private Sub Form_Load()
Command1.Caption = "Start"
Command2.Caption = "Stop"
Label1.Caption = 0
St = false
End Sub
Sub Pause(interval)
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Sub
if you want to do something with TIME then just use something like
MsgBox CStr(time)
-
March 1st, 2000, 12:22 PM
#3
Re: Time
I think this is what you want
'In General Declarations
Dim dtStart as date
Dim dtEnd as date
'-----------------------
private Sub Form_Load()
cmdStart.Enabled = true
cmdEnd.Enabled = false
lblDisplay.Caption = vbNullString
End Sub
private Sub cmdStart_Click()
dtStart = Now()
cmdStart.Enabled = false
cmdEnd.Enabled = true
End Sub
private Sub cmdEnd_Click()
dtEnd = Now()
cmdEnd.Enabled = false
cmdStart.Enabled = true
lblDisplay.Caption = DateDiff("s",dtStart, dtEnd)
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
|