Timer problem...
-
Hi, I'm iusing a Do..until loop to receive data from a modem, one of the conditions for the loop to finish is a boolean variable (bTimeOut), assined to TRUE when then Timer finish is count, i did like: Settings.bTimeOut = False Settings.Timer1.Enabled = True Do If Main.MSComm1.InBufferCount Then Buffer = Buffer & Main.MSComm1.Input Loop Until (InStr(1, Buffer, Res & vbCrLf) Or (Settings.bTimeOut = True)) Settings.Timer1.Enabled = False Settings.bTimeOut = False The problem is that if, the modem answer is not like Res, the loop never ends, i cannot understand why does the Timer do not change my variable state, its function is like: Public Sub Timer1_Timer() bTimeOut = True Timer1.Enabled = False End Sub Can anyone help me with this? Thank you for your time Rui
-
Hi, I'm iusing a Do..until loop to receive data from a modem, one of the conditions for the loop to finish is a boolean variable (bTimeOut), assined to TRUE when then Timer finish is count, i did like: Settings.bTimeOut = False Settings.Timer1.Enabled = True Do If Main.MSComm1.InBufferCount Then Buffer = Buffer & Main.MSComm1.Input Loop Until (InStr(1, Buffer, Res & vbCrLf) Or (Settings.bTimeOut = True)) Settings.Timer1.Enabled = False Settings.bTimeOut = False The problem is that if, the modem answer is not like Res, the loop never ends, i cannot understand why does the Timer do not change my variable state, its function is like: Public Sub Timer1_Timer() bTimeOut = True Timer1.Enabled = False End Sub Can anyone help me with this? Thank you for your time Rui
Have you checked that Settings.bTimeOut is actually being set? Add a watch to the Settings.bTimeOut in the loop and see if it's being set.
-
Have you checked that Settings.bTimeOut is actually being set? Add a watch to the Settings.bTimeOut in the loop and see if it's being set.
Thank you LeeDavies for your answer! Yes, i tried checking the variable state during the loop, i even tried a MsgBox inside the Timer1 function, just to know if it was working! The Timer interval is 2000, instead it never displays the MsgBox, can't understand why... Could it be because, i keep reading from the modem..??? Rui
-
Thank you LeeDavies for your answer! Yes, i tried checking the variable state during the loop, i even tried a MsgBox inside the Timer1 function, just to know if it was working! The Timer interval is 2000, instead it never displays the MsgBox, can't understand why... Could it be because, i keep reading from the modem..??? Rui
It's been staring me in the face all the time. The timer is not being started. It should be timer1.Start and Timer1.Stop, not Timer1.enabled = true