This isn't the code for the actual program I wanted to implement this self-stopping timer in, but it's simple and has the exact same problem:
Public Class Form1
Private Synchro As New Timer()
Private Sub MeLoad() Handles Me.Load
AddHandler Synchro.Tick, AddressOf Synchronize
End Sub
Private Sub Buttonclick() Handles Button1.Click
Synchro.Enabled = True
End Sub
Private Sub Synchronize()
Static Disable As Boolean
If Disable = False Then
MessageBox.Show("If this is the only messagebox, then the code worked.")
Disable = True
Synchro.Enabled = False
Synchro.Stop()
Exit Sub
End If
End Sub
End Class
The idea here is that it's suppose to (using a timer) show the messagebox ONCE and ONLY once per button click. However, what seems to happen (despite the fact that I have 4 ways of trying to tell it to stop) is that the program creates multiple messageboxes until there are a total of about 49 messageboxes on the screen at the same time. I don't know if I'm using the wrong event (unlikely as Tick seems to be the only timer event) or there's a way of stopping the timer that I don't know.

New Topic/Question
Reply



MultiQuote





|