I've had a read of the class library, and put forward a few suggestions:
The Windows.Forms.Timer() class is for single-threaded applications and does not interoperate too well with the form and are for simple timer operations. You seem to be working with a server process, and it is recommended you use the System.Timers.Timer() class. I have a feeling your timer is conflicting with the form. If this is not so, forgive my presumption.
You should then use a event driven delegate to run the timer in the background.
Declare an AddHandler statement and work through the process you are working with:
Declare your boolean trigger as a public variable
Private Input As Boolean = False
Private timer1 As New System.Timers.Timer()
Protected Sub TimerHandler(ByVal o As Object, ByVal e As EventArgs)
If Input Then
aTimer.Stop()
aTimer.Enabled = True
Else
Input = False
End Sub
In the control of container that will run the timer create an AddHandler statement:
Public Sub SomeControl()
AddHandler timer1.Tick, AddressOf TimerHandler
timer1.Interval = 3000
timer1.Start()
While Input = False
' If you want the form to repaint, call this method.
Application.DoEvents()
End Sub
You will have to modify this to suit your puroposes, but I'm fairly certain this should be ok. To do a quick check, run the process, and CTRL+ALT+Delete to see the memory consumption on your app. If this fails, get back to me and we'll try something else.
Enter your message below
Sign in or Join us (it's free).