小弟不才,有求各位了!我现在程序运行的时候,在里面能够增加一个计时器,对一个计算程序运行所用的时间进行计时并显示在程序界面上

解决方案 »

  1.   

    你的意思是运行时加入?大概可以这样(推测的)
    先定义一个timer tmrAction在form上,index=0然后就可以运行时用load tmrAction(i) 创建一个新的timer (i是整数)
      

  2.   

    text之类的控件可以这样动态加,估计timer也可以德
      

  3.   

    在运行前取t1=time
      运行完取t2=time
    运行时间为两者之差
      

  4.   

    注意晚上0:00,要写一句dim t_time as longt_time=timerif t_time=0 then t_time=1
      

  5.   

    if 程序运行 then timer1.enabled=trueprivate sub timer1_timer()
      If se > 59 Then
      se = 0
      m = m + 1
    Else
      se = se + 1
    End If
    If m > 59 Then
      m = 0
      h = h + 1
    End If
    If h > 24 Then
      h = 0
      d = d + 1
    End If
    lblljsj.Caption = Trim(Str(d)) + "天" + Trim(Str(h)) + "小时" + Trim(Str(m)) + "分"
    end sub这是我以前写的程序中的,不知道对你有没有用.
      

  6.   

    用API比较准确.
    timeGetTime或GetTickCount都可以.
      

  7.   

    在窗口中加入一个TIMER1其Interval设为1000,再加入一个TEXTBOXOption Explicit
    Dim StartTime As DatePrivate Sub Form_Load()
        StartTime = Now
    End SubPrivate Sub Timer1_Timer()
        Text1.Text = FormatDateTime(DateAdd("s", DateDiff("s", StartTime, Now), "00:00:00"), vbLongTime)
    End Sub