FORM1 LOAD时就开始计时 从00:00:00开始计时显示在TEXT1。TEXT  不需要很精确
谢了

解决方案 »

  1.   

    Private Sub Form_Load()
        Timer1.Interval = 1000
        Timer1.Enabled = True
        
    End SubPrivate Sub Timer1_Timer()
        Text1.Text = Now
    End Sub
      

  2.   


    Private Sub Form_Load()
        Timer1.Interval = 1000
        Timer1.Enabled = True
        
    End SubPrivate Sub Timer1_Timer()
        Text1.Text = Time
    End Sub
      

  3.   

    Dim StartTimePrivate Sub Form_Load()
        Timer1.Interval = 1000
        Timer1.Enabled = True
        StartTime = Time
        
    End SubPrivate Sub Timer1_Timer()
        Dim intS As Integer
        
        intS = DateDiff("s", StartTime, Time)
        Text1.Text = intS \ 3600 & ":" & (intS Mod 3600) \ 60 & ":" & intS Mod 60End Sub
      

  4.   

    Option Explicit
    Dim strTime As String
    Private Sub Form_Load()
        strTime = Now
        Label1.Caption = "00:00:00"
        Timer1.interval=500
        timer1.enabled=true
    End SubPrivate Sub Timer1_Timer()
        Dim lngTime As Long
        lngTime = DateDiff("s", strTime, Now)
        Label1.Caption = funSecondToFormat(lngTime)
    End Sub
    Public Function funSecondToFormat(ByVal lngP As Long) As String
        Dim strHour As String
        Dim strMin As String
        Dim strSec As String
        strHour = Format(lngP \ 3600, "00")
        strMin = Format((lngP \ 60) - (lngP \ 3600) * 60, "00")
        strSec = Format(lngP Mod 60, "00")
        funSecondToFormat = strHour & ":" & strMin & ":" & strSec
    End Function
      

  5.   

    格式化一下
    Dim StartTimePrivate Sub Form_Load()
        Timer1.Interval = 1000
        Timer1.Enabled = True
        StartTime = Time
        
    End SubPrivate Sub Timer1_Timer()
        Dim intS As Integer
        
        intS = DateDiff("s", StartTime, Time)
        Text1.Text = Format(intS \ 3600, "00") & ":" & Format((intS Mod 3600) \ 60, "00") & ":" & Format(intS Mod 60, "00")End Sub
      

  6.   

    显示分和秒的计时器。Dim StartTimePrivate Sub Form_Load()
        Timer1.Interval = 1000
        Timer1.Enabled = True
        StartTime = Time
        
    End SubPrivate Sub Timer1_Timer()
        Dim intS As Integer
        
        intS = DateDiff("s", StartTime, Time)
        Text1.Text = Format((intS Mod 3600) \ 60, "00") & ":" & Format(intS Mod 60, "00")End Sub
      

  7.   

    测试了一下效果不错,关键点
    DateDiff 函数 返回 Variant (Long) 的值,表示两个指定日期间的时间间隔数目。 
    语法 
    DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]]) 
    DateDiff 函数语法中有下列命名参数: 
    部分 描述 
    interval 必要。字符串表达式,表示用来计算date1 和 date2 的时间差的时间间隔 
    Date1□date2 必要;Variant (Date)。计算中要用到的两个日期。 
    Firstdayofweek 可选。指定一个星期的第一天的常数。如果未予指定,则以星期日为第一天。 
    firstweekofyear 可选。指定一年的第一周的常数。如果未予指定,则以包含 1 月 1 日的星期为第一周。 设置 
    interval 参数的设定值如下: 
    设置 描述 
    yyyy 年 
    q 季 
    m 月 
    y 一年的日数 
    d 日 
    w 一周的日数 
    ww 周 
    h 时 
    n 分钟 
    s 秒 firstdayofweek 参数的设定值如下: 
    常数 值 描述 
    vbUseSystem 0 使用 NLS API 设置。 
    vbSunday 1 星期日(缺省值) 
    vbMonday 2 星期一 
    vbTuesday 3 星期二 
    vbWednesday 4 星期三 
    vbThursday 5 星期四 
    vbFriday 6 星期五 
    vbSaturday 7 星期六 
    常数 值 描述 
    vbUseSystem 0 用 NLS API 设置。 
    vbFirstJan1 1 从包含 1 月 1 日的星期开始(缺省值)。 
    vbFirstFourDays 2 从第一个其大半个星期在新的一年的一周开始。 
    vbFirstFullWeek 3 从第一个无跨年度的星期开始。 说明 
    DateDiff 函数可用来决定两个日期之间所指定的时间间隔数目。例如,可以使用 DateDiff 来计算两个日期之间相隔几日,或计算从今天起到年底还有多少个星期。 
    为了计算 date1 与 date2 相差的日数,可以使用“一年的日数”(y) 或“日”(d)。当 interval 是“一周的日数”(w) 时,DateDiff 返回两日期间的周数。如果 date1 是星期一,DateDiff 计算到 date2 为止的星期一的个数。这个数包含 date2 但不包含 date1。不过,如果 interval 是“周”(ww),则 DateDiff 函数返回两日期间的“日历周”数。由计算 date1 与 date2 之间星期日的个数而得。如果 date2 刚好是星期日,则 date2 也会被加进 DateDiff 的计数结果中;但不论 date1 是否为星期日,都不将它算进去。 
    如果 date1 比 date2 来得晚,则 DateDiff 函数的返回值为负数。 
    firstdayofweek 参数会影响使用时间间隔符号 “W” 或 “WW” 计算的结果。 
    如果 date1 或 date2 是日期文字,则指定的年份成为该日期的固定部分。但是,如果 date1 或 date2 用双引号 (" ") 括起来,且年份略而不提,则在每次计算表达式 date1 或 date2 时,当前年份都会插入到代码之中。这样就可以书写适用于不同年份的程序代码。 
    在计算 12 月 31 日和来年的 1 月 1 日的年份差时,DateDiff 返回 1 表示相差一个年份,虽然实际上只相差一天而已。Dim StartTimePrivate Sub Form_Load()
        Timer1.Interval = 1000
        Timer1.Enabled = True
        StartTime = Time
        
    End SubPrivate Sub Timer1_Timer()
        Dim intS As Integer
        
        intS = DateDiff("s", StartTime, Time)
        
        Text1.Text = Format((intS Mod 3600) \ 60, "00") & ":" & Format(intS Mod 60, "00")End Sub