eneate
asked on
Why does my timer cause run time error 7 out of memory and other glitches
Hi
I have a timer in my app which works fine with it's function but it is causing other major errors. A|fter the app has been running foe a while I get runtime error message 7 out of memory and other glitches as a result. Anyone any experience of this.
This is my timer code, it looks to see if an image is open if it is not it runs several commands if an image is open it does nothing.
I have a timer in my app which works fine with it's function but it is causing other major errors. A|fter the app has been running foe a while I get runtime error message 7 out of memory and other glitches as a result. Anyone any experience of this.
This is my timer code, it looks to see if an image is open if it is not it runs several commands if an image is open it does nothing.
Dim endTime As Double
endTime = frm_toolbar.Timer1 + 1000
Do While frm_toolbar.Timer1 < endTime And exitloop = False
' Debug.Print Now & vbCrLf
DoEvents
Call set_load_buttons
Call check_image_source
Loop
frm_toolbar.Timer1.Interval = 0
frm_toolbar.Timer1.Enabled = False
ASKER
yes
ASKER
how could I make it more conventional? It was worded this way as I had problems getting the app to unload completly. The problems are very random it can work for ages with no problems I can't find any consistancy at the moment.
What are you trying to do?. The usual way is to set the timer interval, and put whatever you want to achieve after the delay in the event
Sorry, clicked in the wrong place.
What are you trying to do?. The usual way is to set the timer interval, and put whatever you want to achieve after the delay in the event
What are you trying to do?. The usual way is to set the timer interval, and put whatever you want to achieve after the delay in the event
'code to start timer
frm_toolbar.Timer1.Interval = 1000
frm_toolbar.Timer1.Enabled = True
Private Sub Timer1_Timer()
Call set_load_buttons
Call check_image_source
frm_toolbar.Timer1.Enabled = False
End Sub
ASKER
Hi, thanks
I've tried that now it doesn't do anything. The idea is that this runs continually through the aplication looking to see if an image is open. If an image is not open the timer kicks in and changes the settings hence the loop in the original code but I think this is causing the memory problem
I've tried that now it doesn't do anything. The idea is that this runs continually through the aplication looking to see if an image is open. If an image is not open the timer kicks in and changes the settings hence the loop in the original code but I think this is causing the memory problem
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> Call set_load_buttons
>> Call check_image_source
The problem could exist in those methods as well.
>> Call check_image_source
The problem could exist in those methods as well.
ASKER
Hi
Thanks for the feedback, removing the loop and at times disablingt the timer and reenabling it appears to have solved the problem. Thanks again
Thanks for the feedback, removing the loop and at times disablingt the timer and reenabling it appears to have solved the problem. Thanks again
It seems to be an unconventional use of the timer.