Infrequently You may do programming with timer. I just make metronome software with timer on visual basic 2010. I use my metronome software to make speed exercise to my guitar lesson.
Put 3 label, 2 textbox, 2 button, 1 picturebox on form and 1 timer component
Here it is the design form:
re
Here it is complete code for metronome software
Public Class Form1
Private i As Integer
Private Sub
Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Timer1.Tick
If i >= txtInterval.Text Then
i = 0
i = i
+ 1
Label1.Text = i
Beep()
End Sub
Private Sub
btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnStart.Click
If txtSecond.Text <> ""
And txtInterval.Text <> "" Then
i
= 0
Timer1.Interval = txtSecond.Text * 1000
Timer1.Start()
Else
MsgBox("Fill Second and Interval",
MsgBoxStyle.Critical, "Error")
End If
End Sub
Private Sub
btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnStop.Click
Label1.Text = 0
Timer1.Stop()
End Sub
End Class
Here it is demo video off my metronome software for my guitar speed exercise:
Here it is demo video off my metronome software for my guitar speed exercise:
OK. Have a nice code :)