Search code examples
c#winformsmodal-dialognon-modal

how to make non-modal dialog remain on top even user launches a modal dialog


I have a Form A that launches Form B as modal dialog. Form B then launches Form C. The requirement is that Form C should remain on top even though if user closes Form B. In order to achieve that I have made Form A as parent for Form C and launching it as non-modal. So far so good, If user closes Form B, Form C still remain visible. Problem is in some cases user can launch a non-modal dialog (Form D) from Form B. In that case I still want to have Form C available but with current scheme its get blocked until user closes Form D. Any suggestion on how to accomplish it.

enter image description here


Solution

  • I don't think you can. From MSDN:

    A modal form or dialog box must be closed or hidden before you can continue working with the rest of the application.

    That's the nature of the modal dialogs that they block. You generally use them to force the user to take some acion in the modal window.