0

Is there any way that we can detect if a child Dialog is opened ? I tried googling there is not any good article There should be a very simple solution to this. Can anyone tell me how to do this ? Is there any method or property in .Net Framework that I can call to get a boolean value somehow whether there is a Modal dialog is opened over my current window ?

Kas
  • 3,747
  • 5
  • 29
  • 56
  • Please check this- https://stackoverflow.com/questions/409945/can-a-form-tell-if-there-are-any-modal-windows-open – Souvik Ghosh Dec 28 '17 at 11:55
  • Dont know if this helps, but you can try this: https://msdn.microsoft.com/en-us/library/system.windows.forms.application.openforms(v=vs.110).aspx – Michael Dec 28 '17 at 11:56
  • Does your child form opened inside the current form, or it is detach from it ? (Is the form location is limited to the area of the form) – Orel Eraki Dec 28 '17 at 12:01
  • @Orel , It's opened with new Form1().ShowDialog(this); – Kas Dec 28 '17 at 12:07

1 Answers1

2

so you want to check if the current Form owns any child modal Forms?

simply use the OwnedForms Property

this.OwnedForms.Any() //should return True if it owns any forms.
shawkyz1
  • 886
  • 5
  • 19