Hidden dialog-box is being disposed

Posted by jquerijero on 05-Oct-2015 11:18

Progress added DisposeDialogOnClose a while back. It is also being applied when Hide() is called on the dialog-box.

Is this the intended behavior? I was expecting that it should only apply when Close() is called or the user close the dialog-box.

All Replies

Posted by Matt Gilarde on 05-Oct-2015 11:44

The dialog is disposed when the ShowDialog method returns. I don't think that there's a way for us to tell that ShowDialog returned because the dialog box was hidden instead of closed.

I believe that it's implemented this way because we don't know that it's a dialog box until ShowDialog is called. Until then it's just a form like any other form. You can set the DisposeDialogOnClose property at the form level so you can set it to false when you hide a dialog box to prevent the automatic disposal.

This thread is closed