ObjectDisposedException Timer

N

Netmonster

Hello,

I’m new to the compact framework and mobile development and I need a
little help. I have a form that has a panel, in the panel there’s a
label that’s tied to a timer. The timer runs ever second. It’s a
countdown and the label is reacting as expected.

The problem is when I shutdown the app, the timer is still running and
I get an ObjectDisposedException Error. I can prevent it from crashing
if I do a try catch in the timers tick method and catch that Exception
type. The problem with that is when I try to launch the app again, it
hangs. I have to do a soft reset in order to start the app again.

Anyone have any suggestions as to what I can do to resolve this?

Thanks in advance,

Kris
 
C

Chris Tacke, eMVP

What kind of a Timer (Thread or Forms)? Why not stop the timer when you
close the Form or when the Form is disposed?


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com



Hello,

I’m new to the compact framework and mobile development and I need a
little help. I have a form that has a panel, in the panel there’s a
label that’s tied to a timer. The timer runs ever second. It’s a
countdown and the label is reacting as expected.

The problem is when I shutdown the app, the timer is still running and
I get an ObjectDisposedException Error. I can prevent it from crashing
if I do a try catch in the timers tick method and catch that Exception
type. The problem with that is when I try to launch the app again, it
hangs. I have to do a soft reset in order to start the app again.

Anyone have any suggestions as to what I can do to resolve this?

Thanks in advance,

Kris
 
K

Kris

What kind of a Timer (Thread or Forms)?  Why not stop the timer when you
close the Form or when the Form is disposed?

--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded communityhttp://community.OpenNETCF.com


Hello,

I’m new to the compact framework and mobile development and I need a
little help. I have a form that has a panel, in the panel there’s a
label that’s tied to a timer. The timer runs ever second.  It’s a
countdown and the label is reacting as expected.

The problem is when I shutdown the app, the timer is still running and
I get an ObjectDisposedException Error. I can prevent it from crashing
if I do a try catch in the timers tick method and catch that Exception
type. The problem with that is when I try to launch the app again, it
hangs. I have to do a soft reset in order to start the app again.

Anyone have any suggestions as to what I can do to resolve this?

Thanks in advance,

Kris

Its a form timer

I tried to override the forms closing. but it doesnt seem to fire even
in debug.


Thanks,

Kris
 
H

Hilton

Use "OnClosing" (just type override and VS will do the rest for you).
However, as Chris alludes to, you should use Windows.Forms.Timer - that way
you won't have the problem of it not starting.

Hilton


What kind of a Timer (Thread or Forms)? Why not stop the timer when you
close the Form or when the Form is disposed?

--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded communityhttp://community.OpenNETCF.com


Hello,

I’m new to the compact framework and mobile development and I need a
little help. I have a form that has a panel, in the panel there’s a
label that’s tied to a timer. The timer runs ever second. It’s a
countdown and the label is reacting as expected.

The problem is when I shutdown the app, the timer is still running and
I get an ObjectDisposedException Error. I can prevent it from crashing
if I do a try catch in the timers tick method and catch that Exception
type. The problem with that is when I try to launch the app again, it
hangs. I have to do a soft reset in order to start the app again.

Anyone have any suggestions as to what I can do to resolve this?

Thanks in advance,

Kris

Its a form timer

I tried to override the forms closing. but it doesnt seem to fire even
in debug.


Thanks,

Kris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top