This Visual Basic tutorial Timers.
In Visual Basic, Timer is design to control the time and to allow the users manipulate a certain task. For instance, when you create a clock , a stopwatch or any task that tells times, a time control is needed.
- Open the Visual Basic, select “File” on the menu, hit new and create a new project.
- The New Project dialog will appear.
Select “windows” in the project types, hit the “windows form application” in the templates and hit “ok“.
- Design the form this way. See it Below.
- Double click the Timer to fire the tick event handler of it and do this following code.
Visual Basic123Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.TickLabel1.Text = TimeOfDayEnd Sub
- Add this following code to start the timer on the first load of the form
Visual Basic123Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.LoadTimer1.Start()End Sub
Readers might read also: