News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

simple stop Watch in vb.net 2005

Started by dhilipkumar, Nov 04, 2008, 08:59 PM

Previous topic - Next topic

dhilipkumar



Stop Watch



Dim a, b, c, d As Integer
    Dim tmr1 As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Enabled = True
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        tmr1 = tmr1 + 1
        TextBox1.Text = tmr1

        If tmr1 = 10 Then
            a = a + 1
            tmr1 = 0
        End If
        If a = 60 Then
            b = b + 1
            a = 0
        End If
        If b = 60 Then
            c = c + 1
            b = 0
        End If
        TextBox2.Text = a
        TextBox3.Text = b
        TextBox4.Text = c
    End Sub
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        a = 0
        b = 0
        c = 0
        d = 0
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Enabled = False
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        TextBox5.Visible = True
        Button4.Visible = True
        Button5.Visible = True
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        TextBox1.Text = 0
        TextBox2.Text = 0
        TextBox3.Text = 0
        TextBox4.Text = 0
        a = 0
        b = 0
        c = 0
        d = 0
        TextBox5.Visible = False
        Button4.Visible = False
        Button5.Visible = False
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        TextBox5.Visible = False
        Button4.Visible = False
        Button5.Visible = False
    End Sub
End Class