2
« on: August 14, 2018, 11:16:55 AM »
I would like to now if it possible to reset a timer to 0 when I arrived at a certain number let say that timer2 is set to timer2 = 60
then heureminutes = heeminute + 1 and the timer2 reset to 0 to made a another cylce
ublic Class MainForm
'*******************************************************************************
'* Stop polling when the form is not visible in order to reduce communications
'* Copy this section of code to every new form created
'*******************************************************************************
Dim TempMinutes As Integer = 0
Dim HeureMinutes As Integer = 0
Dim jourMinutes As Integer = 0
Dim seconderh As Integer = 0
Dim minutesrh As Integer = 0
Dim heuresrh As Integer = 0
Dim joursrh As Integer = 0
Dim minjag As Integer = 0
Dim secjag As Integer = 0
Dim hrjag As Integer = 0
Dim jourjag As Integer = 0
Private NotFirstShow As Boolean
Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
'* Do not start comms on first show in case it was set to disable in design mode
If NotFirstShow Then
AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
Else
NotFirstShow = True
End If
End Sub
'***************************************************************
'* .NET does not close hidden forms, so do it here
'* to make sure forms are disposed and drivers close
'***************************************************************
Private Sub MainForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Dim index As Integer
While index < My.Application.OpenForms.Count
If My.Application.OpenForms(index) IsNot Me Then
My.Application.OpenForms(index).Close()
End If
index += 1
End While
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles TimerPoly1M.Tick
If DataSubscriber1.Value <= 10 Then
TempMinutes = TempMinutes + 1 '* compteur de seconde quand la 18 est arreter
Label3.Text = TempMinutes '* compteur de seconde quand la 18 est arreter
End If
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles TimerPoly2H.Tick
If TempMinutes = 60 Then
HeureMinutes = HeureMinutes + 1 '* Poly 18
Label4.Text = HeureMinutes
End If
End Sub
Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timerpoly3J.Tick
If HeureMinutes = 24 Then
jourMinutes = jourMinutes + 1 '* Poly 18
Label5.Text = jourMinutes
End If
End Sub
Private Sub secondesrh_Tick(sender As Object, e As EventArgs) Handles secondesrh.Tick
If DataSubscriber2.Value <= 0 Then
seconderh = seconderh + 1
Label10.Text = seconderh
End If
End Sub