How to show a modal form, from within another thread?

  • Thread starter Thread starter MSDousti
  • Start date Start date
M

MSDousti

Hi all,

I have written a program, which uses some threads.
I call thread t from the main thread, and then after some work t must
show a modal window.(e.g. a messagebox) but because t is not the main
thread, the window appears non-Modal.

Is it possible to show a modal form, from within another thread?

thnx in advance.
 
MSDousti said:
I have written a program, which uses some threads.
I call thread t from the main thread, and then after some work t
must show a modal window.(e.g. a messagebox) but because t is not the
main thread, the window appears non-Modal.

Is it possible to show a modal form, from within another thread?

Call the BeginInvoke or Invoke method of any control (this includes Forms)
that has been created in the main thread. You can pass a Delegate to
(Begin)Invoke. The Delegate points to a function that that calls ShowDialog.
 
Back
Top