ShowDialog()

N

No Sheds

Hi

I have an MDI application. I have a MDI child window within this
application that shows another form using ShowDialog. This works fine,
except that the final form shown with ShowDialog can't be an MDI child
window, and so can appear outside the boundaries of the main window.

I know I can do something like this:

private withevents FinalForm as someform

Sub Search()
dim FinalForm as new someform
FinalForm.Show
End Sub

Sub FinalFormClosing handles FinalForm.Closing
'Do something when the form closes...
End Sub


However, that means that I have to have the code in two sections. I
much prefer the code to look as it does when I use ShowDialog:

dim FinalForm as new someform
FinalForm.ShowDialog()
'use the result from the FinalForm here...

Is it possible to write something that behaves like ShowDialog, but
works for MDI child forms?

TIA
 
H

Herfried K. Wagner [MVP]

No Sheds said:
I have an MDI application. I have a MDI child window within this
application that shows another form using ShowDialog. This works fine,
except that the final form shown with ShowDialog can't be an MDI child
window, and so can appear outside the boundaries of the main window.

ACK. This behavior is "by design". MDI children should be used to
represent a set of documents, and should not be used to embed all forms of
an application in an MDI container. I would show the window modally to the
MDI container.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top