My program is scheduled to run from 00:00 until 23:59. On the new day the data has to be written on the new day file and the graph will start plotting from begining.
I tried and it does stop at 23:59pm, and everything inside the graph are erased,when 00:00 arrives, It starts plotting from begining again (which is correct), butan error occurs whichsays:
unhandled exception has occured in your app (Access to port COM1 is denied).
Private Shared writer As StreamWriter = New StreamWriter("c:\beacon\" & Now.Day & "_" & Now.Month & "_" & Now.Year & ".txt")
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If DateTime.Now.ToString("HH:mm") = "23:59" Then
yValues.Clear()
average.Clear()
buffer.Clear()
Me.Refresh()
System.Threading.Thread.Sleep(1000)
Else
>>normal operation here
yValues.Add(buffer(i))
'write the data inside txt file at the same time
writer.Write(buffer(i) & vbCrLf)
writer.Flush()
End if
end sub