我想在同一个事件中执行第一条语句后间隔一点时间再执行第二条语句,请问如何实现?

解决方案 »

  1.   

    写在Timer控件中,在属性 InterVal中设置时间,单位为毫秒
    在里面设置要执行的内容
    就会隔一段时间,执行
      

  2.   

    还要timer控件?那还有什么意义?
      

  3.   

    用api函数sleep即可
    同意,只要将这个函数引用进来就可以了。
      

  4.   

    可以使用:Private Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
      

  5.   

    sleep也行,
    用DO While吧,計算時間差.
      

  6.   

    dim loopTime as long
    dim oldTime as date
    looptime=10  '延时10秒
    oldtime=now
    while dateadd("s",looptime,oldtime)<now
       doevents
    wend
      

  7.   

    请土豆说明一下你的程序。我有点看不懂,while那部分的循环条件 。
      

  8.   

    dateadd("s",looptime,oldtime)<now
    这个条件不对吧。
      

  9.   

    一:sleep
    二:
    Function Delay(ByVal n As Single)
        Dim tm1, tm2 As Single
        tm1 = Timer
        Do
           tm2 = Timer
           If tm2 < tm1 Then tm2 = tm2 + 86400
           If tm2 - tm1 > n Then Exit Do
           DoEvents
        Loop
        
    End Function