Form that is already displayed modally cannot be displayed as a modal dialog box. Close the form bef

  • Thread starter Thread starter Jared
  • Start date Start date
J

Jared

Hi,

How can I even show same form twice if modal forces stop of execution.

Poor error, Microsoft.

Error is .
Form that is already displayed modally cannot be displayed as a modal dialog
box. Close the form before calling showDialog.
 
Jared said:
How can I even show same form twice if modal forces stop of execution.

Easily. Foo is shown modally, but has a button that creates a new Foo
and tries to show it modally. (Note that you can do this, if you use
Show, instead of ShowDialog.)
Poor error, Microsoft.

Error is .
Form that is already displayed modally cannot be displayed as a modal dialog
box. Close the form before calling showDialog.

What do you think it should say?
 
Jon,
Easily. Foo is shown modally, but has a button that creates a new Foo
and tries to show it modally. (Note that you can do this, if you use
Show, instead of ShowDialog.)

This fully legitimate code and it will work as long as you create a new
instance of that form class.
On the other hand if you call *this.ShowDialog()* in already displayed form
this is incorrect, but the message is slightly different.
Maybe if Jared posts some steps (or better sample code) of how to reproduce
the problem we'll find out what the problem is.
 
Stoitcho Goutsev (100) said:
This fully legitimate code and it will work as long as you create a new
instance of that form class.
On the other hand if you call *this.ShowDialog()* in already displayed form
this is incorrect, but the message is slightly different.

True. I probably shouldn't post anything just before going to bed.
 
Turned out to be event firing code to showdialog all over agin while
ShowDialog...didn't even know that events from other forms were still
handled while modal form displayed?
 
Back
Top