Threading question

P

Phil

Using C#/.NET 2.0

I have a form that starts a worker thread when the user wants to monitor
data coming from a com port. As new data is received on the com port, I use
a delegate to update a control on the main form.

When I close the main form, I get an error when I try to invoke the delegate
to update the main form. It tells me "Cannot access a disposed object.
Object name: 'Form1'."
I've tried setting the worker thread as a background thread and a foreground
thread, but both crash. Any ideas how to prevent this?
 

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