Imports System
Imports System.Threading
Module Module1
'修改此參數可改變等候時間數, 下面例子為5秒
Dim waitN As New TimeSpan(0, 0, 5)
Sub Main()
Dim newThread As New Thread(AddressOf Waiting)
newThread.Start()
Console.WriteLine("開始...")
If newThread.Join(TimeSpan.op_Addition(waitN, waitN)) Then
Console.WriteLine("5秒時間到!")
End If
Console.ReadKey()
End Sub
Sub Waiting()
Thread.Sleep(waitN)
End Sub
End Module
沒有留言:
張貼留言