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

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.
 
J

Jon Shemitz

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?
 
S

Stoitcho Goutsev \(100\)

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.
 
J

Jon Shemitz

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.
 
J

Jared

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?
 

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