Hi,
can anyone help me understand why after you pressed the button Button1, this application crashes without considering the event timer1??
Code:Public Class Form1 Public timer_event As Boolean Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load timer_event = False Timer1.Interval = 3000 '3 sec Timer1.Enabled = True Timer1.Start() End Sub Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick Timer1.Stop() timer_event = True End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Do If timer_event Then MsgBox(timer_event) timer_event = False Timer1.Start() End If Loop End Sub End Class




Reply With Quote