暫停副含式 以1毫秒為單位
Private Sub Sleep(ByVal t As Single)
Dim start, finish As Double
start = Microsoft.VisualBasic.DateAndTime.Timer
finish = start + t * 0.001
Do
My.Application.DoEvents()
Loop Until Microsoft.VisualBasic.DateAndTime.Timer > finish
End Sub
可利用呼叫API方式會更方便使用SLEEP
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Int32)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Sleep(10000) '暫停10秒
End Sub
沒有留言:
張貼留言