请各位帮忙看一下一个VB小程序的问题.(关于正确显示软件运行时间的)
Option Explicit
Dim t As String
Dim errors As Integer
Dim rights As Integer
Dim rate As Integer
Dim s As Double
Dim e As Double
Private Sub Command1_Click()
Randomize Timer
Dim i As Integer
Dim s As String
For i = 0 To 15
s = s & Chr(Int(Rnd * 26) + 97)
Next i
Label2.Caption = s
t = ""
Text1.Text = ""
errors = 0
rights = 0
s = Timer
End Sub
Private Sub Command2_Click()
e = Timer
Label3.Caption = "正确:" & rights
Label4.Caption = "错误:" & errors
Label5.Caption = "耗时:" & Int(e - s) + 1 ---这里是统计时间的变量
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
t = t & Chr(KeyAscii)
Text1.Text = t
If Len(t) > Len(Label2.Caption) Then
Exit Sub
End If
If KeyAscii <> Asc(Mid(Label2.Caption, Len(t), 1)) Then
errors = errors + 1
'Debug.Print errors, Chr(KeyAscii), Mid(Label2.Caption, Len(t), 1)
Else
rights = rights + 1
End If
End Sub
把这个存为*.frm文件来调试.
我这个程序显示的时间不是我们现在用的"秒",怎么改才能让他表示秒呢?