How can I find the first value of a variable changed in a vb.net timer?
I have this problem:
I have a vb.net class (visual studio 2010) :
....
Private nowTime As String
....
Protected Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
nowTime = My.Computer.Clock.LocalTime.开发者_开发知识库ToLongTimeString
....
End Sub
How can I get the first value of "nowTime" String variable after having the Timer enabled for any interval of time?
Thanks in advance!
Something like this should work.
....
Private nowTime As String
Private firstTime As String
Private isFirstTriggered As Boolean = False
....
Protected Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Not isFirstTriggered Then
firstTime = My.Computer.Clock.LocalTime.ToLongTimeString
isFirstTriggered = True
End If
nowTime = My.Computer.Clock.LocalTime.ToLongTimeString
....
End Sub
精彩评论