VB显示当前程序运行时间

来源:百度知道 编辑:UC知道 时间:2024/06/07 01:55:36
在VB程序里面加一段代码 用Lab控件显示 当前VB程序运行的时间.请问代码怎么写?
是显示程序运行的时间,不是显示系统当前时间。

VB显示当前程序运行的时间长短,需要添加一个Timer控件来实现,代码如下:

Dim Tim As String, B As Long, H As Integer, M As Integer, S As Long
//窗体加载时候方法
Private Sub Form_Load()
    Label1.Caption = ""
    Tim = Time
    Timer1.Interval = 100
End Sub
//Timer控件方法
Private Sub Timer1_Timer()
    s = DateDiff("s", Tim, Time)
    If s > 60 Then
        B = s
        M = B \ 60
        s = B Mod 60
        If M > 60&n