Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15919

[RESOLVED] reset a temp alarm

$
0
0
hello
I'm building a temp monitor application to monitor 16 temperatures. The application is running fine.
I want to improve it a little bit by adding blinking colour and maybe an alarm sound if a temp is above limit. I use a button to reset the alarm blinking but cant make it to stop.
I use 2 timers, one for reading the value and one for the blinking data.

Code:

Public Class Form1
    Dim a As Integer = 1
    Dim s As Integer = 1
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        a = TextBox2.Text
        '' alarm point is 10
        If a > 10 Then
            Timer2.Enabled = True
        Else
            Timer2.Enabled = False
                Label1.BackColor = Color.White
                s = 1
            End If
            Label1.Visible = True
            Label1.Text = TextBox2.Text
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object,
    ByVal e As System.EventArgs) Handles Button1.Click

        Timer2.Enabled = False
        s = 0

    End Sub
    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        Label1.BackColor = Color.Red
        Label1.Text = a
        Label1.Visible = Not Label1.Visible
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ''i insert the values in the textbox2
        TextBox2.Text = 1
    End Sub
End Class

i can make it blink but i cant stop it blinking while the temp is above normal.

Thanks

Viewing all articles
Browse latest Browse all 15919

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>