Ok, here's what I have so far. The notation on line 2 explains what I'm trying to do.
Public Class Form1
Dim RunningTime As Integer = My.Computer.FileSystem.ReadAllText("C:\data.dat") 'need if/then to start countdown if value in data.dat is numeric, pause timer if value is PAUSE, and resume timer if value is RESUME. Right now it assumes the value is numeric and starts the countdown. The app should page the file for new data every 100ms.
Private alarmTime As Date
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.alarmTime = Date.Now.AddSeconds(RunningTime)
Me.Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If alarmTime < Date.Now Then
Me.Timer1.Stop()
Me.Close()
Else
Dim remainingTime As TimeSpan = Me.alarmTime.Subtract(Date.Now)
Me.TextBox1.Text = String.Format("{0:d2}:{1:d2}:{2:d2}:{3:d3}", _
remainingTime.Hours, _
remainingTime.Minutes, _
remainingTime.Seconds, _
remainingTime.Milliseconds)
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
Thanks in advance.