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
 
Back
Top