Tuesday 24 July 2012

timer in vb.net

In this tutorial, we will learn about one of the most fun and useful parts of Visual Basic .NET programming, Timers. Timers are similar to loops but will allow you to select the interval at which the code is executed. When you understand how to use a timer, you will be able to apply it to almost any application that you create. In detail execute a line of code given until stop the timer. Lots of fun with using timer.    

Copy and paste below Code:

Public Class Form1

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        TextBox1.Text = TextBox1.Text + 1
    End Sub

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

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Stop()
    End Sub

End Class

No comments:

Post a Comment