How to check whether the form has any ShowDialog() forms open?
Posted
by kornelijepetak
on Stack Overflow
See other posts from Stack Overflow
or by kornelijepetak
Published on 2010-05-21T07:35:15Z
Indexed on
2010/05/21
7:40 UTC
Read the original article
Hit count: 298
I have a form MainForm with several properties/methods that are accessed from another thread.
At some point I might open a form AuxForm with ShowDialog() and then while that modal form is open, the other thread still modifies the MainForm's properties. This is all desired.
In one of the methods accessed from another thread I need to execute some code, but only if the modal AuxForm is not open. Is there any way to check this (by using .NET WF Form properties) or I need to use a flag variable?
NOTE: None of these properties/methods modify the controls (so no Invoke is required).
© Stack Overflow or respective owner