本文整理匯總了VB.NET中Microsoft.VisualBasic.DateAndTime.Timer屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET DateAndTime.Timer屬性的具體用法?VB.NET DateAndTime.Timer怎麽用?VB.NET DateAndTime.Timer使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。
在下文中一共展示了DateAndTime.Timer屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: waitFiveSeconds
Public Sub waitFiveSeconds()
If TimeOfDay >= #11:59:55 PM# Then
MsgBox("The current time is within 5 seconds of midnight" &
vbCrLf & "The timer returns to 0.0 at midnight")
Return
End If
Dim start, finish, totalTime As Double
If (MsgBox("Press Yes to pause for 5 seconds", MsgBoxStyle.YesNo)) =
MsgBoxResult.Yes Then
start = Microsoft.VisualBasic.DateAndTime.Timer
' Set end time for 5-second duration.
finish = start + 5.0
Do While Microsoft.VisualBasic.DateAndTime.Timer < finish
' Do other processing while waiting for 5 seconds to elapse.
Loop
totalTime = Microsoft.VisualBasic.DateAndTime.Timer - start
MsgBox("Paused for " & totalTime & " seconds")
End If
End Sub