可以使用时钟,timer的事件里控制。
或者使用api函数-SLEEP。

解决方案 »

  1.   

    你是想splash(欢迎)窗口显示几秒钟吧?可以这样:splash窗体,加1个timer,命名为tmrSplash,enabled=false, interval=秒数*1000(如:4秒=4000):private sub form_load()
       tmrsplash.enabled=true
       load frmMain '主窗体
    end subprivate tmrsplash_timer()
       '欢迎窗体显示完毕
       frmmain.show
       tmrsplash.enabled=false
       unload me
    end sub
      

  2.   

    private sub form_load()
    load readme '欢迎窗体
    end sub'欢迎窗体时加入timer
    private tmrsplash_timer()
    a=a+1
    if a=5 then unload me
    end sub
      

  3.   

    private sub form_load()
    readme.show '欢迎窗体
    end sub'欢迎窗体时加入timer
    private tmrsplash_timer()
    a=a+1
    if a=5 then unload me
    end sub
      

  4.   

    当然前提是设置合适的timer控件的interval属性,要想延时几秒,在用以上几位的代码之前,请将interval设置为1000(就是1000毫秒,1秒钟响应一次)
      

  5.   

    直接调用api函数即可:
    Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
    Sleep 1000     '延时1秒
      

  6.   

    Dim StopTheTimer As Boolean
    Public Function Delay(Mins%, Secs%, Optional ByRef StopFlag) As Long
        Dim EndOfDelay
        EndOfDelay = DateAdd("n", Mins, Now)
        EndOfDelay = DateAdd("s", Secs, EndOfDelay)
        Delay = 0
        Do While (Now < EndOfDelay)
            DoEvents
            If Not IsMissing(StopFlag) Then
                If StopFlag Then
                    Delay = 1
                    StopFlag = False
                    Exit Do
                End If
            End If
        Loop
    End FunctionPrivate Sub Command1_Click() '开始延时
        Dim lRetval&
        'lRetval = Delay(分,秒, StopTheTimer)
        lRetval = Delay(0, 5, StopTheTimer)
        If lRetval = 0 Then
            MsgBox "时间到!"
        Else
            MsgBox "取消延时!"
        End If
    End Sub
    Private Sub Command2_Click() '取消延时
        StopTheTimer = True
    End Sub
      

  7.   

    使用gxingmin(小高) 的方法是最好的。
      

  8.   

    Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
    Sleep(1000)      '延时1秒