Sorry - I am still green when it comes to vb.net...
I have a form (Form1) with a label (Label1) and a button (Button1). When I click the button once - it works fine. The second, third, fourth etc don't work properly. I am trying to understand how timers work in .net. Thanks in advance. Here is the code
Public ctr As Integer = 0
Public tmr As New Timer()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
tmr.Interval = 10
tmr.Enabled = True
AddHandler tmr.Tick, AddressOf TimerEventHandler
End Sub
Private Sub TimerEventHandler(ByVal obj As Object, ByVal ergs As EventArgs)
ctr += 1
Label1.Text = ctr
If ctr >= 50 Then
ctr = 0
tmr.Enabled = False
End If
End Sub