I am working on an application in VB.NET for a manufacturing unit that runs in shifts. At the end of every shift, the application should give an alarm indicating that the shift has ended.
In the application, the user keys-in shift time in Hours & Minutes textboxes and saves in a database on Save button click.
As shown in the picture, the First shift ends at 03:30 p.m., Second at 11:30 p.m. & the Third shift at 07:30 a.m. When the application loads, Hours & Minutes of every shift are stored in the variables.
My query is, how do I convert the values from these variables into time format (HH:mm) so that I can compare the shift time with system time and raise an alarm when the shift ends everyday irrespective of the date. Below is a code that I have tried so far..
Private Sub TmrMonitor_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TmrMonitor.Tick
Dim Tim As String = TxtHH.Text & ":" & TxtMM.Text
LblShift.Text = (DateTime.ParseExact(Tim, "hh:mm", CultureInfo.InvariantCulture)) = DateTime.Now()
TmrMonitor.Stop()
ReadReg() ' Read data from PLC
If FormActive = True Then
TmrMonitor.Start()
End If
CommStat() ' PLC communication status
End Sub
Thanks in advance.
Prashant.