Canceling A Modal Dialog Before the Constructor Is Complete

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way that a form being displayed with SHowDialog() can be closed
from within the constructor?

It seems that this.Close() is ignored.
 
Forms are just classes. It does not call the constructor when you run the
ShowDialog method. It runs the constructor when you instantiate the object
(form). So:

MyDialogForm frm = new MyDialogForm(); // <- Constructor called
frm.ShowDialog(this); // <- Method call

HTH,

John Scragg
 

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

Back
Top