Showing posts with label timer. Show all posts
Showing posts with label timer. Show all posts

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

Saturday, 28 January 2012

vb.net code for timer?


How to use timer in vb.net?
This tutorial you can learn how to play with timer in vb.net?
Step1:
Open Microsoft visual studio
Step2:
Open file newà windows form application àrename it as timer
Step3:
Drag and drop the one text box, two buttons, timer, and one label
Step4:
Write or copy the below code on program window
Code:
Public Class Form1

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

    Private Sub Button1_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) HandlesButton1.Click
        Timer1.Start()
      

    End Sub

    Private SubButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton2.Click
        Timer1.Stop()
    End Sub
End Class

Output: