window appears when thread is done

S

Steven

Hello,

I have an application with several windows forms. On form A, I run a
thread. Meanwhile, another windows form, say B, is opened. But when the
thread, started from form A is finished, form A appears on top of form B.

Does anyone knows a method or setting to prevent form A from being
placed on top of B when the thread is finished?

Thanks,

Steven
 
H

Herfried K. Wagner [MVP]

* Steven said:
I have an application with several windows forms. On form A, I run a
thread. Meanwhile, another windows form, say B, is opened. But when
the thread, started from form A is finished, form A appears on top of
form B.

Are you sure you never access the controls/forms from the other thread?
Are you creating the 2nd form inside the other thread? Notice that
Windows Forms controls' instance members are not safe for
multithreading.

If you are not accessing the controls/forms from the thread <> the UI
thread, you may want to call the form's 'Activate' method.
 

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