Option ExplicitPrivate Sub Command1_Click()
   If DateDiff("n", Text1.Text, Time) >= 10 Then MsgBox "OK"
End Sub如果 当前系统时间 大于等于 text1.text中的时间就弹出 “OK”也就是说 如果现在系统时间是20:00:00  text1.text中的时间是19:00:00 那就会弹出 OK简单点说就是只要间隔是10分钟就弹出OK现在问题出来了,如果当前系统时间是0:00:00的时候就有问题了我就想只要间隔时间是10分钟或者大于10分钟就弹出 OK大侠帮忙改下啊,分不多大侠帮帮忙啊。

解决方案 »

  1.   

    Option Explicit
    Dim lngP As Long
    Private Declare Function GetTickCount Lib "kernel32" () As LongPrivate Sub Form_Load()
        lngP = GetTickCount
        Timer1.Enabled = True
        Timer1.Interval = 100
    End SubPrivate Sub Timer1_Timer()
        If GetTickCount - lngP > 600000 Then
            MsgBox "OK"
            lngP = GetTickCount
        End If
    End Sub
      

  2.   

    我text1.text里的时间是获取一个ini里的时间啊,这个不行啊
      

  3.   

    Private Sub Command1_Click()
      dim t as long
      t=datediff("n",Text1.text,Time)
      if t<0 then t=24*60+t
     
      If t >= 10 Then 
        MsgBox "OK" 
      end if
    End Sub
      

  4.   

    需要带上日期才能解决0:00:00的问题,如
        sTime2 = Format(Now, "yyyy-mm-dd hh:mm:ss")
    text1.text中的时间也应是这种格式,才能用datediff函数,在sql语句中得到时间差
      

  5.   

    Private Sub Command1_Click()
      If Abs(DateDiff("n", Text1.Text, Time)) >= 10 Then MsgBox "OK"
    End Sub